Mesa (master): pan/midg: Fix 2 memory leaks
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 22 15:33:39 UTC 2021
Module: Mesa
Branch: master
Commit: 51a4bca3c33126fc6057b8edde300e0c1749a4ef
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=51a4bca3c33126fc6057b8edde300e0c1749a4ef
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Thu Apr 22 16:14:41 2021 +0200
pan/midg: Fix 2 memory leaks
The ssa_constants hash table and its elements are leaked. Pass the
context to the allocator to avoid that.
Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10408>
---
src/panfrost/midgard/midgard_compile.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 0cd0e96044b..e1f0afaa8b2 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -435,7 +435,7 @@ emit_load_const(compiler_context *ctx, nir_load_const_instr *instr)
{
nir_ssa_def def = instr->def;
- midgard_constants *consts = rzalloc(NULL, midgard_constants);
+ midgard_constants *consts = rzalloc(ctx, midgard_constants);
assert(instr->def.num_components * instr->def.bit_size <= sizeof(*consts) * 8);
@@ -3040,7 +3040,7 @@ midgard_compile_shader_nir(nir_shader *nir,
/* Initialize at a global (not block) level hash tables */
- ctx->ssa_constants = _mesa_hash_table_u64_create(NULL);
+ ctx->ssa_constants = _mesa_hash_table_u64_create(ctx);
/* Lower gl_Position pre-optimisation, but after lowering vars to ssa
* (so we don't accidentally duplicate the epilogue since mesa/st has
More information about the mesa-commit
mailing list