From 0ab926dfbf56ad6482b875d980ae95c533b765f9 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Wed, 21 Oct 2015 11:36:39 -0700 Subject: [PATCH] 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'. --- src/vulkan/anv_device.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)); -- 2.30.2