anv: Allow null handle in DestroyDescriptorUpdateTemplate.
authorGiovanni Mascellani <gmascellani@codeweavers.com>
Fri, 12 Feb 2021 07:36:58 +0000 (08:36 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 12 Feb 2021 09:30:46 +0000 (09:30 +0000)
By the Vulkan specification, and similarly to many other Vulkan calls,
it is allowed to destroy a null descriptor update template.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Fixes: af5f13e58c9dfe ("anv: add VK_KHR_descriptor_update_template support")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9005>

src/intel/vulkan/anv_descriptor_set.c

index e3895a7723431286ee7afcbd275ee64f0b91b765..a8d91b36ed076ea8435c2288dfa8dbbf1e03c6ce 100644 (file)
@@ -1805,6 +1805,9 @@ void anv_DestroyDescriptorUpdateTemplate(
    ANV_FROM_HANDLE(anv_descriptor_update_template, template,
                    descriptorUpdateTemplate);
 
+   if (!template)
+      return;
+
    vk_object_base_finish(&template->base);
    vk_free2(&device->vk.alloc, pAllocator, template);
 }