From 1545fe685cafa9c3f7f0965bf373b41e36613940 Mon Sep 17 00:00:00 2001 From: Satya Benson Date: Tue, 3 Nov 2026 11:29:53 -0500 Subject: [PATCH 1/2] asahi: Release failed context allocations with ralloc The context belongs to ralloc, so release its owner with ralloc_free when uploader creation fails. Derive the embedded pipe pointer only after checking allocation success. Signed-off-by: Satya Benson --- src/gallium/drivers/asahi/agx_pipe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index c769f062345d..0cca09db504a 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -1924,12 +1924,13 @@ static struct pipe_context * agx_create_context(struct pipe_screen *screen, void *priv, unsigned flags) { struct agx_context *ctx = rzalloc(NULL, struct agx_context); - struct pipe_context *pctx = &ctx->base; int ret; if (!ctx) return NULL; + struct pipe_context *pctx = &ctx->base; + pctx->screen = screen; pctx->priv = priv; @@ -1938,7 +1939,7 @@ agx_create_context(struct pipe_screen *screen, void *priv, unsigned flags) pctx->stream_uploader = u_upload_create_default(pctx); if (!pctx->stream_uploader) { - FREE(pctx); + ralloc_free(ctx); return NULL; } pctx->const_uploader = pctx->stream_uploader; From 39a605a901578976cb6c03a48021f3d7bee9ade7 Mon Sep 17 00:00:00 2001 From: Satya Benson Date: Tue, 3 Nov 2026 11:29:53 -0500 Subject: [PATCH 2/2] zink: Initialize spare query-start slots in the query test The synthetic split-query case appends starts directly, bypassing the production allocator that zeroes new capacity. Teardown visits the entire capacity to release retained references, so uninitialized spare slots can crash the test. Zero this all-empty synthetic backing before teardown. Signed-off-by: Satya Benson --- src/gallium/drivers/zink/zink_query_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/drivers/zink/zink_query_test.c b/src/gallium/drivers/zink/zink_query_test.c index c9c2eef62d59..455d99f65964 100644 --- a/src/gallium/drivers/zink/zink_query_test.c +++ b/src/gallium/drivers/zink/zink_query_test.c @@ -139,6 +139,8 @@ main(void) assert(can_direct_poll_query_result(&q)); util_dynarray_append(&q.starts, split); assert(!can_direct_poll_query_result(&q)); + /* Teardown also visits spare slots, as the production allocator permits. */ + memset(q.starts.data, 0, q.starts.capacity); uint64_t values[] = {2048, 2048}; union pipe_query_result result; util_query_clear_result(&result, q.type);