vulkan/runtime: fix memleak when creating ETC pipelines

NIR must be freed.

Found with ASAN.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37844>
(cherry picked from commit ddef2c1559)
This commit is contained in:
Samuel Pitoiset 2025-10-13 13:46:34 +02:00 committed by Eric Engestrom
parent 131f2c2aea
commit 649cd492e5
2 changed files with 7 additions and 3 deletions

View file

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

View file

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