diff options
author | Brian <[email protected]> | 2007-04-19 15:37:24 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-04-21 10:05:05 -0600 |
commit | 11e3f733ba5c26f68fb8a7d69e6f94c1b5361f7d (patch) | |
tree | f54695036bba1395e9aa0e52ac57513711ad8fa2 /src/mesa/shader | |
parent | 98ef18909a97dea9a28f0fe30797c0353a1117ce (diff) |
free subroutine array (fix mem leak)
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index c2f2e85ff14..badeb69b3fe 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -1762,6 +1762,7 @@ _slang_resolve_subroutines(slang_emit_info *emitInfo) mainP->Instructions = _mesa_realloc_instructions(mainP->Instructions, mainP->NumInstructions, total); + mainP->NumInstructions = total; for (i = 0; i < emitInfo->NumSubroutines; i++) { struct gl_program *sub = emitInfo->Subroutines[i]; _mesa_copy_instructions(mainP->Instructions + subroutineLoc[i], @@ -1771,7 +1772,13 @@ _slang_resolve_subroutines(slang_emit_info *emitInfo) sub->Parameters = NULL; /* prevent double-free */ _mesa_delete_program(ctx, sub); } - mainP->NumInstructions = total; + + /* free subroutine list */ + if (emitInfo->Subroutines) { + _mesa_free(emitInfo->Subroutines); + emitInfo->Subroutines = NULL; + } + emitInfo->NumSubroutines = 0; /* Examine CAL instructions. * At this point, the BranchTarget field of the CAL instructions is |