[Mesa-dev] [PATCH] radv: always free nir shaders from modules on stack
Grazvydas Ignotas
notasas at gmail.com
Tue May 2 20:05:44 UTC 2017
valgrind reports them as leaked, and I could not find anything making a
copy of the nir pointer. Also, radv_device_init_meta_blit_color() is
already freeing them unconditionally like this.
Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
---
src/amd/vulkan/radv_meta_blit.c | 6 ++----
src/amd/vulkan/radv_query.c | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/amd/vulkan/radv_meta_blit.c b/src/amd/vulkan/radv_meta_blit.c
index cc8ca32..ee3e286 100644
--- a/src/amd/vulkan/radv_meta_blit.c
+++ b/src/amd/vulkan/radv_meta_blit.c
@@ -1292,14 +1292,12 @@ radv_device_init_meta_blit_state(struct radv_device *device)
result = radv_device_init_meta_blit_depth(device, &vs);
if (result != VK_SUCCESS)
goto fail;
result = radv_device_init_meta_blit_stencil(device, &vs);
- if (result != VK_SUCCESS)
- goto fail;
- return VK_SUCCESS;
fail:
ralloc_free(vs.nir);
- radv_device_finish_meta_blit_state(device);
+ if (result != VK_SUCCESS)
+ radv_device_finish_meta_blit_state(device);
return result;
}
diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
index 6d2325d..a0241ca 100644
--- a/src/amd/vulkan/radv_query.c
+++ b/src/amd/vulkan/radv_query.c
@@ -610,16 +610,14 @@ VkResult radv_device_init_meta_query_state(struct radv_device *device)
result = radv_CreateComputePipelines(radv_device_to_handle(device),
radv_pipeline_cache_to_handle(&device->meta_state.cache),
1, &pipeline_statistics_vk_pipeline_info, NULL,
&device->meta_state.query.pipeline_statistics_query_pipeline);
- if (result != VK_SUCCESS)
- goto fail;
- return VK_SUCCESS;
fail:
- radv_device_finish_meta_query_state(device);
+ if (result != VK_SUCCESS)
+ radv_device_finish_meta_query_state(device);
ralloc_free(occlusion_cs.nir);
ralloc_free(pipeline_statistics_cs.nir);
return result;
}
--
2.7.4
More information about the mesa-dev
mailing list