From 495cb16fa39e89fed6dd76b21c62602379304117 Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Mon, 20 Nov 2017 16:22:09 +0100 Subject: [PATCH] Fixed bug in case vkBindImageMemory/vkBindBufferMemory fails. --- src/vk_mem_alloc.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h index 3e6f0a7..a5371c0 100644 --- a/src/vk_mem_alloc.h +++ b/src/vk_mem_alloc.h @@ -8246,6 +8246,8 @@ VkResult vmaCreateBuffer( } allocator->FreeMemory(*pAllocation); *pAllocation = VK_NULL_HANDLE; + (*allocator->GetVulkanFunctions().vkDestroyBuffer)(allocator->m_hDevice, *pBuffer, allocator->GetAllocationCallbacks()); + *pBuffer = VK_NULL_HANDLE; return res; } (*allocator->GetVulkanFunctions().vkDestroyBuffer)(allocator->m_hDevice, *pBuffer, allocator->GetAllocationCallbacks()); @@ -8324,6 +8326,8 @@ VkResult vmaCreateImage( } allocator->FreeMemory(*pAllocation); *pAllocation = VK_NULL_HANDLE; + (*allocator->GetVulkanFunctions().vkDestroyImage)(allocator->m_hDevice, *pImage, allocator->GetAllocationCallbacks()); + *pImage = VK_NULL_HANDLE; return res; } (*allocator->GetVulkanFunctions().vkDestroyImage)(allocator->m_hDevice, *pImage, allocator->GetAllocationCallbacks());