From: Ian Romanick Date: Thu, 5 Nov 2009 22:17:07 +0000 (-0800) Subject: ARB prog parser: Release old program string in _mesa_parse_arb_{fragment,vertex}_program X-Git-Tag: 062012170305~15905^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d8e256f9236d3e9dfd433c3a59718f0fdf1ca79a;p=profile%2Fivi%2Fmesa.git ARB prog parser: Release old program string in _mesa_parse_arb_{fragment,vertex}_program The program structure passed to _mesa_parse_arb_program is just a place holder. The stings that actually need to be released are only known to the functions calling _mesa_parse_arb_program, so they should be freed there. --- diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 05ee4f5..dd732b6 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -87,6 +87,9 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, return; } + if (program->Base.String != NULL) + _mesa_free(program->Base.String); + /* Copy the relevant contents of the arb_program struct into the * fragment_program struct. */ @@ -178,6 +181,9 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, return; } + if (program->Base.String != NULL) + _mesa_free(program->Base.String); + /* Copy the relevant contents of the arb_program struct into the * vertex_program struct. */ diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index b2db295..aad5eeb 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -2304,10 +2304,6 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, _mesa_memcpy (strz, str, len); strz[len] = '\0'; - if (state->prog->String != NULL) { - _mesa_free(state->prog->String); - } - state->prog->String = strz; state->st = _mesa_symbol_table_ctor();