From 892c2949ed7f668435aa55c6d13f76764b61298d Mon Sep 17 00:00:00 2001 From: Gabríel Arthúr Pétursson Date: Sat, 3 Jun 2017 23:33:57 +0000 Subject: layers: Destroy physical devices in object tracker's vkDestroyInstance The objects are allocated in EnumeratePhysicalDevices, but were never destroyed after use. --- layers/object_tracker.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'layers/object_tracker.cpp') diff --git a/layers/object_tracker.cpp b/layers/object_tracker.cpp index 9702c6a7..775b3b28 100644 --- a/layers/object_tracker.cpp +++ b/layers/object_tracker.cpp @@ -398,6 +398,16 @@ VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocati // TODO: The instance handle can not be validated here. The loader will likely have to validate it. ValidateObject(instance, instance, kVulkanObjectTypeInstance, true, VALIDATION_ERROR_2580bc01, VALIDATION_ERROR_UNDEFINED); + // Destroy physical devices + for (auto iit = instance_data->object_map[kVulkanObjectTypePhysicalDevice].begin(); + iit != instance_data->object_map[kVulkanObjectTypePhysicalDevice].end();) { + OBJTRACK_NODE *pNode = iit->second; + + VkPhysicalDevice physical_device = reinterpret_cast(pNode->handle); + DestroyObject(instance, physical_device, kVulkanObjectTypePhysicalDevice, nullptr, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); + iit = instance_data->object_map[kVulkanObjectTypePhysicalDevice].begin(); + } + DestroyObject(instance, instance, kVulkanObjectTypeInstance, pAllocator, VALIDATION_ERROR_258004ec, VALIDATION_ERROR_258004ee); // Report any remaining objects in LL -- cgit v1.2.3