radv: always free nir shaders from modules on stack
authorGrazvydas Ignotas <notasas@gmail.com>
Tue, 2 May 2017 19:46:06 +0000 (22:46 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Tue, 9 May 2017 22:13:44 +0000 (01:13 +0300)
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@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_meta_blit.c
src/amd/vulkan/radv_query.c

index 439309903d0e4593ef4d4147967d6b87d68e711c..f63fa6795c0c02d0327f6856d7756ea33cee7a10 100644 (file)
@@ -1259,12 +1259,10 @@ radv_device_init_meta_blit_state(struct radv_device *device)
                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;
 }
index 88d8ccb050cf27bce441bb08e0f8aab0d443a66a..f79b3e6a313cfb361c3c3c55266dff19adc5dcef 100644 (file)
@@ -614,12 +614,10 @@ VkResult radv_device_init_meta_query_state(struct radv_device *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;