From 649cd492e5200dfc73ffce246f7ff8280dcf40cd Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 13 Oct 2025 13:46:34 +0200 Subject: [PATCH] vulkan/runtime: fix memleak when creating ETC pipelines NIR must be freed. Found with ASAN. Cc: mesa-stable Signed-off-by: Samuel Pitoiset Part-of: (cherry picked from commit ddef2c1559c0c5ab13b94d4787e33badb3034135) --- .pick_status.json | 2 +- src/vulkan/runtime/vk_texcompress_etc2.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index ea703df4a30..84524ad49e0 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1404,7 +1404,7 @@ "description": "vulkan/runtime: fix memleak when creating ETC pipelines", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/vulkan/runtime/vk_texcompress_etc2.c b/src/vulkan/runtime/vk_texcompress_etc2.c index 558d91e95dd..5697a86fc62 100644 --- a/src/vulkan/runtime/vk_texcompress_etc2.c +++ b/src/vulkan/runtime/vk_texcompress_etc2.c @@ -437,6 +437,7 @@ etc2_init_pipeline(struct vk_device *device, struct vk_texcompress_etc2_state *e { const struct vk_device_dispatch_table *disp = &device->dispatch_table; VkDevice _device = vk_device_to_handle(device); + VkResult result; nir_shader *cs = etc2_build_shader(device, etc2->nir_options); @@ -452,8 +453,11 @@ etc2_init_pipeline(struct vk_device *device, struct vk_texcompress_etc2_state *e .layout = etc2->pipeline_layout, }; - return disp->CreateComputePipelines(_device, etc2->pipeline_cache, 1, &pipeline_create_info, etc2->allocator, - &etc2->pipeline); + result = disp->CreateComputePipelines(_device, etc2->pipeline_cache, 1, &pipeline_create_info, etc2->allocator, + &etc2->pipeline); + + ralloc_free(cs); + return result; } static VkResult