Mesa (7.10): glsl: Use reralloc instead of plain realloc.
Ian Romanick
idr at kemper.freedesktop.org
Tue Mar 1 01:37:17 UTC 2011
Module: Mesa
Branch: 7.10
Commit: c9ded4d41889ee331ec3a069f80475816f17d527
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9ded4d41889ee331ec3a069f80475816f17d527
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Sun Feb 27 01:17:29 2011 -0800
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.
(cherry picked from commit eb639349e289a6b8be06a54f5e9e0ce18c71d511)
---
src/glsl/ast_to_hir.cpp | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 593f09d..0b30445 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3263,11 +3263,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;
More information about the mesa-commit
mailing list