From: Chad Versace Date: Wed, 21 Oct 2015 18:36:39 +0000 (-0700) Subject: anv: Don't teardown uninitialized anv_physical_device X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0ab926dfbf56ad6482b875d980ae95c533b765f9;p=mesa.git anv: Don't teardown uninitialized anv_physical_device If the user called vkDestroyDevice but never called vkEnumeratePhysicalDevices, then the driver tried to ralloc_free() an unitialized anv_physical_device. Fixes test 'dEQP-VK.api.device_init.create_instance_name_version'. --- diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index fd87c85b0ce..d450b2b4e87 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -224,7 +224,12 @@ void anv_DestroyInstance( { ANV_FROM_HANDLE(anv_instance, instance, _instance); - anv_physical_device_finish(&instance->physicalDevice); + if (instance->physicalDeviceCount > 0) { + /* We support at most one physical device. */ + assert(instance->physicalDeviceCount == 1); + anv_physical_device_finish(&instance->physicalDevice); + } + anv_finish_wsi(instance); VG(VALGRIND_DESTROY_MEMPOOL(instance));