From 0299600efb904c59c91a69cabfc36cfcf6a9ec61 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 6 Feb 2022 15:44:35 -0500 Subject: [PATCH] asahi: Fix memory unsafety in delete_sampler_state The type is wrong, masked by a void*, meaning the free is completely wrong. ASan is rightfully unhappy. Fixes crashes destroying the context. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index f6f4428c5bd..ab56e86f924 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -367,8 +367,8 @@ agx_create_sampler_state(struct pipe_context *pctx, static void agx_delete_sampler_state(struct pipe_context *ctx, void *state) { - struct agx_bo *bo = state; - agx_bo_unreference(bo); + struct agx_sampler_state *so = state; + agx_bo_unreference(so->desc); } static void