From 79f4e33f04bfbb2bda67ab6f12b4ceabe1d85a60 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Mon, 9 May 2022 09:14:28 +0200 Subject: [PATCH] v3dv: don't leak variant QPU when pipeline compile fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Typically we free them when we upload the QPU code from the variant to the assembly BO in the pipeline, however, if there is an error during pipeline compilation that may not happen and we would leak the QPU code from the variants. Reviewed-by: Alejandro PiƱeiro Part-of: --- src/broadcom/vulkan/v3dv_pipeline.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index f2c6dac319d..c3dbac57227 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -94,6 +94,8 @@ v3dv_shader_variant_destroy(struct v3dv_device *device, /* The assembly BO is shared by all variants in the pipeline, so it can't * be freed here and should be freed with the pipeline */ + if (variant->qpu_insts) + free(variant->qpu_insts); ralloc_free(variant->prog_data.base); vk_free(&device->vk.alloc, variant); }