summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/program/arbprogparse.c2
-rw-r--r--src/mesa/program/program_parse.y13
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;
}