mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 21:08:11 +02:00
glsl: fix memory leak
A slightly modified version of a patch from Vinson Lee.
This commit is contained in:
parent
4f9f5a7840
commit
4c2a7bc438
1 changed files with 6 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue