anv: Properly handle destroying NULL devices and instances

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "17.0 13.0" <mesa-dev@lists.freedesktop.org>
This commit is contained in:
Jason Ekstrand 2017-03-01 08:39:49 -08:00
parent f3ec9d33c6
commit e3d33a23e6
1 changed files with 6 additions and 0 deletions

View File

@ -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);