From: Dave Airlie Date: Mon, 6 Mar 2017 05:40:16 +0000 (+1000) Subject: radv: Properly handle destroying NULL devices and instances X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6bae1e44a99f909359879951743599e6d6c1cc28;p=mesa.git radv: Properly handle destroying NULL devices and instances Ported from anv: 3d33a23e anv: Properly handle destroying NULL devices and instances Reviewed-by: Bas Nieuwenhuizen Signed-off-by: Dave Airlie --- diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 58f37c631f8..ab04473b01c 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -365,6 +365,9 @@ void radv_DestroyInstance( { RADV_FROM_HANDLE(radv_instance, instance, _instance); + if (!instance) + return; + for (int i = 0; i < instance->physicalDeviceCount; ++i) { radv_physical_device_finish(instance->physicalDevices + i); } @@ -988,6 +991,9 @@ void radv_DestroyDevice( { RADV_FROM_HANDLE(radv_device, device, _device); + if (!device) + return; + if (device->trace_bo) device->ws->buffer_destroy(device->trace_bo);