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'.
{
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));