aboutsummaryrefslogtreecommitdiff
path: root/layers
diff options
context:
space:
mode:
authorJózef Kucia <joseph.kucia@gmail.com>2017-06-16 11:52:21 +0200
committerMark Lobodzinski <mark@lunarg.com>2017-06-16 13:17:33 -0600
commit0f49f430bc46400a8eedcdee234fa1e1bbe1db2d (patch)
treeb2eba6ff3f59e93c66b893b2b6c9277293f8fb88 /layers
parent6ee2cc98e26b26c7b5b7a58dbd4b17ea47cc64b2 (diff)
downloadusermoji-0f49f430bc46400a8eedcdee234fa1e1bbe1db2d.tar.xz
layers: Fix memory leak in device destroy_dispatch_table
Change-Id: I14aa005db87caab3cbb28a4e06b1d2a76c931341
Diffstat (limited to 'layers')
-rw-r--r--layers/vk_layer_table.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/layers/vk_layer_table.cpp b/layers/vk_layer_table.cpp
index fed66bf3..7b5a394e 100644
--- a/layers/vk_layer_table.cpp
+++ b/layers/vk_layer_table.cpp
@@ -52,8 +52,8 @@ VkLayerInstanceDispatchTable *instance_dispatch_table(void *object) {
}
void destroy_dispatch_table(device_table_map &map, dispatch_key key) {
-#if DISPATCH_MAP_DEBUG
device_table_map::const_iterator it = map.find((void *)key);
+#if DISPATCH_MAP_DEBUG
if (it != map.end()) {
fprintf(stderr, "destroy device dispatch_table: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, it->second);
} else {
@@ -61,7 +61,10 @@ void destroy_dispatch_table(device_table_map &map, dispatch_key key) {
assert(it != map.end());
}
#endif
- map.erase(key);
+ if (it != map.end()) {
+ delete it->second;
+ map.erase(it);
+ }
}
void destroy_dispatch_table(instance_table_map &map, dispatch_key key) {