From 8cf2cdd2c9d53cb26a4e32b7e677bf7e37900cfc Mon Sep 17 00:00:00 2001 From: Daniel Rakos Date: Thu, 22 Jun 2023 11:20:54 +0200 Subject: mock: Fix memory leak issue --- icd/generated/function_definitions.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'icd/generated/function_definitions.h') diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h index 5eb09156..d5a7a343 100644 --- a/icd/generated/function_definitions.h +++ b/icd/generated/function_definitions.h @@ -250,6 +250,14 @@ static VKAPI_ATTR void VKAPI_CALL DestroyDevice( } } + for (auto& cp : command_pool_map[device]) { + for (auto& cb : command_pool_buffer_map[cp]) { + DestroyDispObjHandle((void*) cb); + } + command_pool_buffer_map.erase(cp); + } + command_pool_map[device].clear(); + queue_map.erase(device); buffer_map.erase(device); image_memory_size_map.erase(device); @@ -1095,6 +1103,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateCommandPool( { unique_lock_t lock(global_lock); *pCommandPool = (VkCommandPool)global_unique_handle++; + command_pool_map[device].insert(*pCommandPool); return VK_SUCCESS; } @@ -1113,6 +1122,7 @@ static VKAPI_ATTR void VKAPI_CALL DestroyCommandPool( } command_pool_buffer_map.erase(it); } + command_pool_map[device].erase(commandPool); } static VKAPI_ATTR VkResult VKAPI_CALL ResetCommandPool( -- cgit v1.2.3