diff options
| author | Józef Kucia <joseph.kucia@gmail.com> | 2017-06-16 11:52:21 +0200 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2017-06-16 13:17:33 -0600 |
| commit | 091327496dd23b73399fa7b8809c65bcbd03d29e (patch) | |
| tree | 4c3f143b9070e27e57dfd8f249ae2667bd520580 /layers/vk_layer_table.cpp | |
| parent | 0f49f430bc46400a8eedcdee234fa1e1bbe1db2d (diff) | |
| download | usermoji-091327496dd23b73399fa7b8809c65bcbd03d29e.tar.xz | |
layers: Fix memory leak in instance destroy_dispatch_table
Change-Id: I8152960f30f73a997386aa9bf3561d2e0e8b408d
Diffstat (limited to 'layers/vk_layer_table.cpp')
| -rw-r--r-- | layers/vk_layer_table.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/layers/vk_layer_table.cpp b/layers/vk_layer_table.cpp index 7b5a394e..dcf5c47c 100644 --- a/layers/vk_layer_table.cpp +++ b/layers/vk_layer_table.cpp @@ -68,8 +68,8 @@ void destroy_dispatch_table(device_table_map &map, dispatch_key key) { } void destroy_dispatch_table(instance_table_map &map, dispatch_key key) { -#if DISPATCH_MAP_DEBUG instance_table_map::const_iterator it = map.find((void *)key); +#if DISPATCH_MAP_DEBUG if (it != map.end()) { fprintf(stderr, "destroy instance dispatch_table: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, it->second); } else { @@ -77,7 +77,10 @@ void destroy_dispatch_table(instance_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_device_dispatch_table(dispatch_key key) { destroy_dispatch_table(tableMap, key); } |
