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 a8e21ca..7ae5c9d 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);
 }