Mesa (master): util/vk_alloc: Ensure NULL is handled correctly in vk_free

Jason Ekstrand jekstrand at kemper.freedesktop.org
Thu Nov 17 04:07:41 UTC 2016


Module: Mesa
Branch: master
Commit: d0646c8015015b90bcc933e23bdd927cc0c81bb7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0646c8015015b90bcc933e23bdd927cc0c81bb7

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu Nov 10 21:12:16 2016 -0800

util/vk_alloc: Ensure NULL is handled correctly in vk_free

Reviewed-by: Dave Airlie <airlied at redhat.com>

---

 src/util/vk_alloc.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/vk_alloc.h b/src/util/vk_alloc.h
index a8e21ca..7ae5c9d 100644
--- a/src/util/vk_alloc.h
+++ b/src/util/vk_alloc.h
@@ -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);
 }
 




More information about the mesa-commit mailing list