summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Stroyan <[email protected]>2014-03-11 17:07:00 -0600
committerBrian Paul <[email protected]>2014-03-12 09:43:05 -0600
commit6e627b49f9c9b62bb116a738305a564d4f28e633 (patch)
tree9413e3bc38721fe80f61192b6a073588ca06d250
parent2c886eba7820f7e3e965dd16b786b0a412d8ef11 (diff)
mesa: Release gl_debug_state when destroying context.
Commit 6e8d04a caused a leak by allocating ctx->Debug but never freeing it. Release the memory in _mesa_free_errors_data when destroying a context. Use FREE to match CALLOC_STRUCT from _mesa_get_debug_state. Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/mesa/main/errors.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 8ec6a8c33b8..9151718eab6 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -969,7 +969,7 @@ _mesa_init_errors(struct gl_context *ctx)
/**
* Loop through debug group stack tearing down states for
- * filtering debug messages.
+ * filtering debug messages. Then free debug output state.
*/
void
_mesa_free_errors_data(struct gl_context *ctx)
@@ -980,6 +980,9 @@ _mesa_free_errors_data(struct gl_context *ctx)
for (i = 0; i <= ctx->Debug->GroupStackDepth; i++) {
free_errors_data(ctx, i);
}
+ FREE(ctx->Debug);
+ /* set to NULL just in case it is used before context is completely gone. */
+ ctx->Debug = NULL;
}
}