From 034657bf6c932fce6006f9926fe10ffc19cc7315 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 16 Sep 2020 13:18:15 -0400 Subject: [PATCH] zink: just call context destructor on creation fail this more reliably handles the failure case Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index a6f5802a1b4..887b9887d65 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -1806,14 +1806,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) return &ctx->base; fail: - if (ctx) { - for (int i = 0; i < ARRAY_SIZE(ctx->batches); ++i) { - vkDestroyDescriptorPool(screen->dev, ctx->batches[i].descpool, NULL); - vkFreeCommandBuffers(screen->dev, ctx->batches[i].cmdpool, 1, &ctx->batches[i].cmdbuf); - vkDestroyCommandPool(screen->dev, ctx->batches[i].cmdpool, NULL); - } - vkDestroyCommandPool(screen->dev, ctx->compute_batch.cmdpool, NULL); - FREE(ctx); - } + if (ctx) + zink_context_destroy(&ctx->base); return NULL; }