From 5cb6570e1456bde73a4df2065d6fe0f915d84e3a Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sat, 11 Jul 2020 16:22:37 -0700 Subject: [PATCH] Fixed leak checking for >1 stack trace depth --- BeefRT/dbg/DbgInternal.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BeefRT/dbg/DbgInternal.cpp b/BeefRT/dbg/DbgInternal.cpp index fc3b61fc..4bed7521 100644 --- a/BeefRT/dbg/DbgInternal.cpp +++ b/BeefRT/dbg/DbgInternal.cpp @@ -385,26 +385,26 @@ bf::System::Object* Internal::Dbg_ObjectAlloc(bf::System::ClassVData* classVData // through. intptr dbgAllocInfo; - auto classVDataVal = (intptr)classVData | (intptr)BfObjectFlag_Allocated; - result->mClassVData = classVDataVal; + auto classVDataVal = (intptr)classVData | (intptr)BfObjectFlag_Allocated; if (maxStackTraceDepth <= 1) dbgAllocInfo = (intptr)BF_RETURN_ADDRESS; else { if (largeAllocInfo) { - result->mClassVData |= (intptr)BfObjectFlag_AllocInfo; + classVDataVal |= (intptr)BfObjectFlag_AllocInfo; dbgAllocInfo = size; *(intptr*)((uint8*)result + size) = capturedTraceCount; memcpy((uint8*)result + size + sizeof(intptr), stackTrace, capturedTraceCount * sizeof(intptr)); } else { - result->mClassVData |= (intptr)BfObjectFlag_AllocInfo_Short; + classVDataVal |= (intptr)BfObjectFlag_AllocInfo_Short; dbgAllocInfo = (size << 16) | capturedTraceCount; memcpy((uint8*)result + size, stackTrace, capturedTraceCount * sizeof(intptr)); } } + result->mClassVData = classVDataVal; BF_FULL_MEMORY_FENCE(); // Since we depend on mDbAllocInfo to determine if we are allocated, we need to set this last after we're set up result->mDbgAllocInfo = dbgAllocInfo; BF_FULL_MEMORY_FENCE();