diff options
author | Marcin Slusarz <[email protected]> | 2010-01-17 14:47:53 -0800 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-01-18 10:39:27 -0700 |
commit | e5347ca94dd58351aa81ec09addd537f1dbc3e9d (patch) | |
tree | 969f6e7f66fa1f704686c868458e8d167796ce25 /src/mesa | |
parent | 3310fe0e91c86df098a499a55f7aed5530f10290 (diff) |
st/mesa: fix memory leak in st_translate_mesa_program
Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index e788008dfe1..f07846f8212 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -779,6 +779,7 @@ st_translate_mesa_program( { struct st_translate translate, *t; unsigned i; + enum pipe_error ret = PIPE_OK; t = &translate; memset(t, 0, sizeof *t); @@ -865,8 +866,10 @@ st_translate_mesa_program( t->constants = CALLOC( program->Parameters->NumParameters, sizeof t->constants[0] ); - if (t->constants == NULL) + if (t->constants == NULL) { + ret = PIPE_ERROR_OUT_OF_MEMORY; goto out; + } for (i = 0; i < program->Parameters->NumParameters; i++) { switch (program->Parameters->Parameters[i].Type) { @@ -920,8 +923,6 @@ st_translate_mesa_program( t->insn[t->labels[i].branch_target] ); } - return PIPE_OK; - out: FREE(t->insn); FREE(t->labels); @@ -931,7 +932,7 @@ out: debug_printf("%s: translate error flag set\n", __FUNCTION__); } - return PIPE_ERROR_OUT_OF_MEMORY; + return ret; } |