mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 13:18:04 +02:00
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.
This commit is contained in:
parent
301a9b7e28
commit
d8e256f923
2 changed files with 6 additions and 4 deletions
|
|
@ -87,6 +87,9 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (program->Base.String != NULL)
|
||||||
|
_mesa_free(program->Base.String);
|
||||||
|
|
||||||
/* Copy the relevant contents of the arb_program struct into the
|
/* Copy the relevant contents of the arb_program struct into the
|
||||||
* fragment_program struct.
|
* fragment_program struct.
|
||||||
*/
|
*/
|
||||||
|
|
@ -178,6 +181,9 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (program->Base.String != NULL)
|
||||||
|
_mesa_free(program->Base.String);
|
||||||
|
|
||||||
/* Copy the relevant contents of the arb_program struct into the
|
/* Copy the relevant contents of the arb_program struct into the
|
||||||
* vertex_program struct.
|
* vertex_program struct.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2304,10 +2304,6 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
|
||||||
_mesa_memcpy (strz, str, len);
|
_mesa_memcpy (strz, str, len);
|
||||||
strz[len] = '\0';
|
strz[len] = '\0';
|
||||||
|
|
||||||
if (state->prog->String != NULL) {
|
|
||||||
_mesa_free(state->prog->String);
|
|
||||||
}
|
|
||||||
|
|
||||||
state->prog->String = strz;
|
state->prog->String = strz;
|
||||||
|
|
||||||
state->st = _mesa_symbol_table_ctor();
|
state->st = _mesa_symbol_table_ctor();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue