util/vk_alloc: Ensure NULL is handled correctly in vk_free
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 11 Nov 2016 05:12:16 +0000 (21:12 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 17 Nov 2016 04:07:23 +0000 (20:07 -0800)
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/util/vk_alloc.h

index a8e21cade11751f2867b9671a3a662b44486b2f2..7ae5c9dfe40cacbc66f5ca4f9fa3097211dd5fbc 100644 (file)
@@ -46,6 +46,9 @@ vk_realloc(const VkAllocationCallbacks *alloc,
 static inline void
 vk_free(const VkAllocationCallbacks *alloc, void *data)
 {
+   if (data == NULL)
+      return;
+
    alloc->pfnFree(alloc->pUserData, data);
 }