Mesa (master): anv: Properly handle destroying NULL devices and instances

Jason Ekstrand jekstrand at kemper.freedesktop.org
Wed Mar 1 23:32:02 UTC 2017


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

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Wed Mar  1 08:39:49 2017 -0800

anv: Properly handle destroying NULL devices and instances

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: "17.0 13.0" <mesa-dev at lists.freedesktop.org>

---

 src/intel/vulkan/anv_device.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 0db96f2..238e149 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -360,6 +360,9 @@ void anv_DestroyInstance(
 {
    ANV_FROM_HANDLE(anv_instance, instance, _instance);
 
+   if (!instance)
+      return;
+
    if (instance->physicalDeviceCount > 0) {
       /* We support at most one physical device. */
       assert(instance->physicalDeviceCount == 1);
@@ -1095,6 +1098,9 @@ void anv_DestroyDevice(
 {
    ANV_FROM_HANDLE(anv_device, device, _device);
 
+   if (!device)
+      return;
+
    anv_device_finish_blorp(device);
 
    anv_queue_finish(&device->queue);




More information about the mesa-commit mailing list