glsl2: Use talloc_zero_size instead of talloc_size to allocate ast_node objects.
authorCarl Worth <cworth@cworth.org>
Tue, 3 Aug 2010 00:27:56 +0000 (17:27 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 3 Aug 2010 00:27:56 +0000 (17:27 -0700)
This is a zero-ing function, (like calloc), to avoid bugs due to
accessing uninitialized values. Thanks to valgrind for noticing the
use of uninitialized values.

src/glsl/ast.h

index 1de285bb46102f61e463cda9f54441078ba8b795..7ce879bb79ddea2897e5f6b97a20205882a1d1ed 100644 (file)
@@ -42,7 +42,7 @@ public:
    {
       void *node;
 
-      node = talloc_size(ctx, size);
+      node = talloc_zero_size(ctx, size);
       assert(node != NULL);
 
       return node;