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'.
This commit is contained in:
Chad Versace 2015-10-21 11:36:39 -07:00
parent c8572d0f9c
commit 0ab926dfbf

View file

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