diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-11-10 21:32:32 -0800 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2016-11-24 16:34:40 +0000 |
commit | 8dbdbc21910a6d37c381535186f9e728fff8690d (patch) | |
tree | 32819901880e1092e9f5d5054c468db1196f41c1 /src/intel/vulkan/anv_image.c | |
parent | 045420ea06b6aacdaab3dbf5915c3747093e6506 (diff) | |
download | external_mesa3d-8dbdbc21910a6d37c381535186f9e728fff8690d.zip external_mesa3d-8dbdbc21910a6d37c381535186f9e728fff8690d.tar.gz external_mesa3d-8dbdbc21910a6d37c381535186f9e728fff8690d.tar.bz2 |
anv: Handle null in all destructors
This fixes a bunch of new CTS tests which look for exactly this. Even in
the cases where we just call vk_free to free a CPU data structure, we still
handle NULL explicitly. This way we're less likely to forget to handle
NULL later should we actually do something less trivial.
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 49f08ad77f51cc344e4bfe60ba9f8d9fccfbd753)
[Emil Velikov: color_rt_surface_state is still around]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/intel/vulkan/anv_image.c
Diffstat (limited to 'src/intel/vulkan/anv_image.c')
-rw-r--r-- | src/intel/vulkan/anv_image.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index b7c2e99..4a4d87e 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -275,8 +275,12 @@ anv_DestroyImage(VkDevice _device, VkImage _image, const VkAllocationCallbacks *pAllocator) { ANV_FROM_HANDLE(anv_device, device, _device); + ANV_FROM_HANDLE(anv_image, image, _image); + + if (!image) + return; - vk_free2(&device->alloc, pAllocator, anv_image_from_handle(_image)); + vk_free2(&device->alloc, pAllocator, image); } VkResult anv_BindImageMemory( @@ -565,6 +569,9 @@ anv_DestroyImageView(VkDevice _device, VkImageView _iview, ANV_FROM_HANDLE(anv_device, device, _device); ANV_FROM_HANDLE(anv_image_view, iview, _iview); + if (!iview) + return; + if (iview->color_rt_surface_state.alloc_size > 0) { anv_state_pool_free(&device->surface_state_pool, iview->color_rt_surface_state); @@ -655,6 +662,9 @@ anv_DestroyBufferView(VkDevice _device, VkBufferView bufferView, ANV_FROM_HANDLE(anv_device, device, _device); ANV_FROM_HANDLE(anv_buffer_view, view, bufferView); + if (!view) + return; + if (view->surface_state.alloc_size > 0) anv_state_pool_free(&device->surface_state_pool, view->surface_state); |