aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stroyan <mike@LunarG.com>2015-07-31 16:20:39 -0600
committerMike Stroyan <mike@LunarG.com>2015-08-04 16:36:55 -0600
commit2508eb3f89f27a3519ea552a8290fd0602be8054 (patch)
tree3d5dc4c94c94582077602f1f5f1cb40f7e3e78c8
parent4192027f9395f9512bf39cf46a7abcaae9957f2e (diff)
downloadusermoji-2508eb3f89f27a3519ea552a8290fd0602be8054.tar.xz
layers: Fix freed memory use in layer_destroy_msg_callback
Defer free in layer_destroy_msg_callback until after last use of data.
-rw-r--r--layers/vk_layer_logging.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/layers/vk_layer_logging.h b/layers/vk_layer_logging.h
index b81a5e5f..bb3087dd 100644
--- a/layers/vk_layer_logging.h
+++ b/layers/vk_layer_logging.h
@@ -176,25 +176,31 @@ static inline void layer_destroy_msg_callback(
{
VkLayerDbgFunctionNode *pTrav = debug_data->g_pDbgFunctionHead;
VkLayerDbgFunctionNode *pPrev = pTrav;
+ bool matched;
debug_data->active_flags = 0;
while (pTrav) {
if (pTrav->msgCallback == msg_callback) {
+ matched = true;
pPrev->pNext = pTrav->pNext;
if (debug_data->g_pDbgFunctionHead == pTrav) {
debug_data->g_pDbgFunctionHead = pTrav->pNext;
}
- free(pTrav);
debug_report_log_msg(
debug_data, VK_DBG_REPORT_DEBUG_BIT,
VK_OBJECT_TYPE_MSG_CALLBACK, pTrav->msgCallback.handle,
0, DEBUG_REPORT_NONE,
"DebugReport",
"Destroyed callback");
+ } else {
+ matched = false;
}
debug_data->active_flags |= pTrav->msgFlags;
pPrev = pTrav;
pTrav = pTrav->pNext;
+ if (matched) {
+ free(pPrev);
+ }
}
}