zink: just call context destructor on creation fail

this more reliably handles the failure case

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9149>
This commit is contained in:
Mike Blumenkrantz 2020-09-16 13:18:15 -04:00 committed by Marge Bot
parent 66d5966426
commit 034657bf6c

View file

@ -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;
}