diff options
author | Brian Paul <brianp@vmware.com> | 2009-10-27 16:28:39 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-10-27 17:00:30 -0600 |
commit | 4c2a7bc4380017bec53a88cd9a8385cad73a9f0d (patch) | |
tree | 1885a2bd0567b891dc1e9f7e7f739ee8215f049f /src/mesa/shader | |
parent | 4f9f5a78408dbd86b2f9c25ee8a15581b9122fcc (diff) |
glsl: fix memory leak
A slightly modified version of a patch from Vinson Lee.
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/slang/slang_link.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 71038d2d94..144c126525 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -104,7 +104,7 @@ link_varying_vars(GLcontext *ctx, GLuint *map, i, firstVarying, newFile; GLbitfield *inOutFlags; - map = (GLuint *) malloc(prog->Varying->NumParameters * sizeof(GLuint)); + map = (GLuint *) _mesa_malloc(prog->Varying->NumParameters * sizeof(GLuint)); if (!map) return GL_FALSE; @@ -135,6 +135,7 @@ link_varying_vars(GLcontext *ctx, &shProg->Varying->Parameters[j]; if (var->Size != v->Size) { link_error(shProg, "mismatched varying variable types"); + _mesa_free(map); return GL_FALSE; } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_CENTROID)) { @@ -142,6 +143,7 @@ link_varying_vars(GLcontext *ctx, _mesa_snprintf(msg, sizeof(msg), "centroid modifier mismatch for '%s'", var->Name); link_error(shProg, msg); + _mesa_free(map); return GL_FALSE; } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_INVARIANT)) { @@ -149,6 +151,7 @@ link_varying_vars(GLcontext *ctx, _mesa_snprintf(msg, sizeof(msg), "invariant modifier mismatch for '%s'", var->Name); link_error(shProg, msg); + _mesa_free(map); return GL_FALSE; } } @@ -160,6 +163,7 @@ link_varying_vars(GLcontext *ctx, if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) { link_error(shProg, "Too many varying variables"); + _mesa_free(map); return GL_FALSE; } @@ -199,7 +203,7 @@ link_varying_vars(GLcontext *ctx, } } - free(map); + _mesa_free(map); /* these will get recomputed before linking is completed */ prog->InputsRead = 0x0; |