mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
mesa: ARB program parser should clean parameters
Program parser allocates parameter list. In case of parsing error some variables will not be freed. Patch adds freeing of it. Signed-off-by: Sergii Romantsov <sergii.romantsov@globallogic.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
382e3553af
commit
88340372ee
2 changed files with 13 additions and 2 deletions
|
|
@ -175,8 +175,6 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
|
|||
|
||||
if (!_mesa_parse_arb_program(ctx, target, (const GLubyte*) str, len,
|
||||
&state)) {
|
||||
ralloc_free(prog.arb.Instructions);
|
||||
ralloc_free(prog.String);
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glProgramString(bad program)");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2532,6 +2532,10 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st
|
|||
*/
|
||||
strz = (GLubyte *) ralloc_size(state->mem_ctx, len + 1);
|
||||
if (strz == NULL) {
|
||||
if (state->prog->Parameters) {
|
||||
_mesa_free_parameter_list(state->prog->Parameters);
|
||||
state->prog->Parameters = NULL;
|
||||
}
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
|
@ -2643,5 +2647,14 @@ error:
|
|||
_mesa_symbol_table_dtor(state->st);
|
||||
state->st = NULL;
|
||||
|
||||
if (result != GL_TRUE) {
|
||||
if (state->prog->Parameters) {
|
||||
_mesa_free_parameter_list(state->prog->Parameters);
|
||||
state->prog->Parameters = NULL;
|
||||
}
|
||||
ralloc_free(state->prog->String);
|
||||
state->prog->String = NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue