From 645f5187ed6eca33dabb97b5d1e8444afbc2d49e Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 22 Feb 2024 18:01:44 -0400 Subject: [PATCH] agx: don't leak shuffle copies ==42579==ERROR: LeakSanitizer: detected memory leaks Direct leak of 9408 byte(s) in 147 object(s) allocated from: #0 0xffff244c4828 in __interceptor_realloc.part.0 (/usr/lib64/libasan.so.8.0.0+0xc4828) (BuildId: 3109905b64795755dad05d7bb29ad23633a06660) #1 0xffff1fc71fe0 in util_dynarray_ensure_cap ../src/util/u_dynarray.h:109 #2 0xffff1fc71fe0 in util_dynarray_grow_bytes ../src/util/u_dynarray.h:157 #3 0xffff1fc71fe0 in assign_regs_by_copying ../src/asahi/compiler/agx_register_allocate.c:440 #4 0xffff1fc73858 in find_regs ../src/asahi/compiler/agx_register_allocate.c:648 #5 0xffff1fc77d3c in pick_regs ../src/asahi/compiler/agx_register_allocate.c:1010 #6 0xffff1fc77d3c in agx_ra_assign_local ../src/asahi/compiler/agx_register_allocate.c:1098 #7 0xffff1fc77d3c in agx_ra ../src/asahi/compiler/agx_register_allocate.c:1355 #8 0xffff1fc3b6c4 in agx_compile_function_nir ../src/asahi/compiler/agx_compile.c:2840 Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_register_allocate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/asahi/compiler/agx_register_allocate.c b/src/asahi/compiler/agx_register_allocate.c index 7790abec95d..1b6d2d2901a 100644 --- a/src/asahi/compiler/agx_register_allocate.c +++ b/src/asahi/compiler/agx_register_allocate.c @@ -602,6 +602,8 @@ find_regs(struct ra_ctx *rctx, agx_instr *I, unsigned dest_idx, unsigned count, util_dynarray_num_elements(&copies, struct agx_copy)); } + util_dynarray_fini(&copies); + /* assign_regs asserts this is cleared, so clear to be reassigned */ BITSET_CLEAR_RANGE(rctx->used_regs[cls], reg, reg + count - 1); return reg;