Mesa (glsl2): ir_reader: Free memory for S-Expressions earlier.

Eric Anholt anholt at kemper.freedesktop.org
Fri Jun 25 17:24:10 PDT 2010


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Jun 25 13:10:37 2010 -0700

ir_reader: Free memory for S-Expressions earlier.

There's no point in keeping it around once we've read the IR.

Also, remove an unnecessary talloc_parent call.

---

 src/glsl/ir_reader.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index 7383c42..03dce0d 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -70,8 +70,7 @@ void
 _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions,
 		   const char *src)
 {
-   void *ctx = talloc_parent(state);
-   s_expression *expr = s_expression::read_expression(ctx, src);
+   s_expression *expr = s_expression::read_expression(state, src);
    if (expr == NULL) {
       ir_read_error(state, NULL, "couldn't parse S-Expression.");
       return;
@@ -82,6 +81,7 @@ _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions,
       return;
 
    read_instructions(state, instructions, expr, NULL);
+   talloc_free(expr);
 }
 
 static void



More information about the mesa-commit mailing list