diff options
author | Sergii Romantsov <[email protected]> | 2019-05-28 12:24:36 +0300 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-06-03 16:41:26 -0400 |
commit | 88340372eea64aeb8bb578e0fc070019d77b83dd (patch) | |
tree | c9becc2e9372abd54da085949ab98b4f004d5926 /src/mesa/program | |
parent | 382e3553af4257c4dff517bbe183a2c69a1bc8d7 (diff) |
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 <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/program')
-rw-r--r-- | src/mesa/program/arbprogparse.c | 2 | ||||
-rw-r--r-- | src/mesa/program/program_parse.y | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c index 4038e475c92..99aa6914624 100644 --- a/src/mesa/program/arbprogparse.c +++ b/src/mesa/program/arbprogparse.c @@ -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; } diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index 7398f5f507a..f468e3b9b59 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -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; } |