Mesa (glsl2): glsl2: Use talloc_zero_size instead of talloc_size to allocate ast_node objects.

Carl Worth cworth at kemper.freedesktop.org
Tue Aug 3 00:29:13 UTC 2010


Module: Mesa
Branch: glsl2
Commit: 1575070bfeedbc7decb7e44ac81abaeec0497a07
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1575070bfeedbc7decb7e44ac81abaeec0497a07

Author: Carl Worth <cworth at cworth.org>
Date:   Mon Aug  2 17:27:56 2010 -0700

glsl2: Use talloc_zero_size instead of talloc_size to allocate ast_node objects.

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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index 1de285b..7ce879b 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -42,7 +42,7 @@ public:
    {
       void *node;
 
-      node = talloc_size(ctx, size);
+      node = talloc_zero_size(ctx, size);
       assert(node != NULL);
 
       return node;




More information about the mesa-commit mailing list