Change-Id: I8152960f30f73a997386aa9bf3561d2e0e8b408d
}
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 {
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); }