aboutsummaryrefslogtreecommitdiff
path: root/layers
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2015-06-11 16:11:20 -0500
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-06-18 10:22:57 -0600
commite1855739b2373d50c028e165b00439c86d722fac (patch)
tree6c0001e0fca0b780e20c248e9ed1058ebbe79075 /layers
parent8943c8b20cafb404422df03f36c8ba64be75ae79 (diff)
downloadusermoji-e1855739b2373d50c028e165b00439c86d722fac.tar.xz
layers: Fix memtracker segfault for ill-behaved apps
Freeing object memory before destroying object resulted in a segfault. This is illegal but shouldn't crash the layer.
Diffstat (limited to 'layers')
-rw-r--r--layers/mem_tracker.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index a0f45bcd..44fc5d95 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -430,6 +430,10 @@ static void reportMemReferencesAndCleanUp(
/* TODO: Would be nice to return the actual object type */
log_msg(mdd(pMemObjInfo->object), VK_DBG_REPORT_INFO_BIT, (VkObjectType) 0, (*it), 0, MEMTRACK_NONE, "MEM",
"VK Object %p still has a reference to mem obj %p", (*it), pMemObjInfo->mem);
+
+ // Found an object referencing this memory, remove its pointer to this memobj
+ MT_OBJ_INFO *pObjInfo = get_object_info(*it);
+ pObjInfo->pMemObjInfo = NULL;
}
// Clear the list of hanging references
pMemObjInfo->pObjBindings.clear();