From 51a4bca3c33126fc6057b8edde300e0c1749a4ef Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 22 Apr 2021 16:14:41 +0200 Subject: [PATCH] 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 Reviewed-by: Alyssa Rosenzweig Part-of: --- 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