mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 12:00:12 +01:00
glsl: Use reralloc instead of plain realloc.
Plugs a memory leak when compiling shaders with user defined structures. NOTE: This is a candidate for the 7.9 and 7.10 branches.
This commit is contained in:
parent
c33e091d17
commit
eb639349e2
1 changed files with 3 additions and 5 deletions
|
|
@ -3445,11 +3445,9 @@ ast_struct_specifier::hir(exec_list *instructions,
|
|||
if (!state->symbols->add_type(name, t)) {
|
||||
_mesa_glsl_error(& loc, state, "struct `%s' previously defined", name);
|
||||
} else {
|
||||
|
||||
const glsl_type **s = (const glsl_type **)
|
||||
realloc(state->user_structures,
|
||||
sizeof(state->user_structures[0]) *
|
||||
(state->num_user_structures + 1));
|
||||
const glsl_type **s = reralloc(state, state->user_structures,
|
||||
const glsl_type *,
|
||||
state->num_user_structures + 1);
|
||||
if (s != NULL) {
|
||||
s[state->num_user_structures] = t;
|
||||
state->user_structures = s;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue