From 782d376363368dfe6d761898fe35698666c0a88e Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 30 Jan 2023 20:11:52 -0600 Subject: [PATCH] nvk: Don't free the NIR in nvk_compile_nir It's a layering violation and the NIR is currently leaked if we the compile fails. It's better to make the caller clean up. Part-of: --- src/nouveau/vulkan/nvk_compute_pipeline.c | 1 + src/nouveau/vulkan/nvk_shader.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nouveau/vulkan/nvk_compute_pipeline.c b/src/nouveau/vulkan/nvk_compute_pipeline.c index 11d2959032a..41c763a9591 100644 --- a/src/nouveau/vulkan/nvk_compute_pipeline.c +++ b/src/nouveau/vulkan/nvk_compute_pipeline.c @@ -101,6 +101,7 @@ nvk_compute_pipeline_create(struct nvk_device *device, nvk_lower_nir(device, nir, pipeline_layout); result = nvk_compile_nir(pdevice, nir, &pipeline->base.shaders[MESA_SHADER_COMPUTE]); + ralloc_free(nir); if (result != VK_SUCCESS) goto fail; diff --git a/src/nouveau/vulkan/nvk_shader.c b/src/nouveau/vulkan/nvk_shader.c index f496866eaf3..d9dc08f2ffa 100644 --- a/src/nouveau/vulkan/nvk_shader.c +++ b/src/nouveau/vulkan/nvk_shader.c @@ -193,7 +193,6 @@ nvk_compile_nir(struct nvk_physical_device *device, nir_shader *nir, if (info_out.io.fp64) shader->hdr[0] |= 1 << 27; - ralloc_free(nir); return VK_SUCCESS; }