From b8c026a3651dbb9524784b3c7687382cb8dad9ec Mon Sep 17 00:00:00 2001 From: Roman Stratiienko Date: Sun, 4 Sep 2022 13:15:42 +0300 Subject: [PATCH] lima: Ensure jobs initialized before calling lima_job_fini() To avoid crash during cleanup if lima_context_create fails. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7196 Signed-off-by: Roman Stratiienko Reviewed-by: Vasily Khoruzhick Part-of: --- src/gallium/drivers/lima/lima_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/lima/lima_context.c b/src/gallium/drivers/lima/lima_context.c index 1d283d6b95f..d4f1552e0e9 100644 --- a/src/gallium/drivers/lima/lima_context.c +++ b/src/gallium/drivers/lima/lima_context.c @@ -139,7 +139,8 @@ lima_context_destroy(struct pipe_context *pctx) struct lima_context *ctx = lima_context(pctx); struct lima_screen *screen = lima_screen(pctx->screen); - lima_job_fini(ctx); + if (ctx->jobs) + lima_job_fini(ctx); for (int i = 0; i < lima_ctx_buff_num; i++) pipe_resource_reference(&ctx->buffer_state[i].res, NULL);