aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Sullivan <jeff.sullivan@woven-planet.global>2023-11-07 17:53:46 +0900
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2023-11-07 10:06:58 -0700
commit0e16099d44a690bb7445b3b2231bb106d6887f8c (patch)
tree1193244ab809b503625cc141327b0d0a73262f60
parent20b2ff19588be983ae75f3f1e243b2fd2380872d (diff)
downloadusermoji-0e16099d44a690bb7445b3b2231bb106d6887f8c.tar.xz
icd: Unmap mapped memory before freeing it
-rw-r--r--icd/generated/function_definitions.h1
-rw-r--r--scripts/mock_icd_generator.py2
2 files changed, 3 insertions, 0 deletions
diff --git a/icd/generated/function_definitions.h b/icd/generated/function_definitions.h
index 61e5f39a..c2678efa 100644
--- a/icd/generated/function_definitions.h
+++ b/icd/generated/function_definitions.h
@@ -403,6 +403,7 @@ static VKAPI_ATTR void VKAPI_CALL FreeMemory(
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
+ UnmapMemory(device, memory);
unique_lock_t lock(global_lock);
allocated_memory_size_map.erase(memory);
}
diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py
index 499669f8..ea5c2f61 100644
--- a/scripts/mock_icd_generator.py
+++ b/scripts/mock_icd_generator.py
@@ -1497,6 +1497,8 @@ class MockICDOutputGenerator(OutputGenerator):
elif True in [ftxt in api_function_name for ftxt in ['Destroy', 'Free']]:
self.appendSection('command', '//Destroy object')
if 'FreeMemory' in api_function_name:
+ # If the memory is mapped, unmap it
+ self.appendSection('command', ' UnmapMemory(device, memory);')
# Remove from allocation map
self.appendSection('command', ' unique_lock_t lock(global_lock);')
self.appendSection('command', ' allocated_memory_size_map.erase(memory);')