diff options
author | Sasha Semennikov <alsemenn@microsoft.com> | 2016-06-09 10:56:57 -0700 |
---|---|---|
committer | Sasha Semennikov <alsemenn@microsoft.com> | 2016-06-09 10:56:57 -0700 |
commit | ce40049d1a4d94a63581694cbb3fd18222e318aa (patch) | |
tree | fb25f53b6962ea3fd6f14722c4c452430d396382 /src/debug | |
parent | 20fcbd02607d1d768061f2be4702d55b45d9920c (diff) | |
parent | 8ab40acd69273f941c3d815f448e0d27431ba5b6 (diff) | |
download | coreclr-ce40049d1a4d94a63581694cbb3fd18222e318aa.tar.gz coreclr-ce40049d1a4d94a63581694cbb3fd18222e318aa.tar.bz2 coreclr-ce40049d1a4d94a63581694cbb3fd18222e318aa.zip |
Merge pull request #5470 from alsemenn/fix1379
Fix memory leak in issue #1379
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/daccess/request.cpp | 36 | ||||
-rw-r--r-- | src/debug/daccess/task.cpp | 11 |
2 files changed, 27 insertions, 20 deletions
diff --git a/src/debug/daccess/request.cpp b/src/debug/daccess/request.cpp index b49b30283f..9e864769c4 100644 --- a/src/debug/daccess/request.cpp +++ b/src/debug/daccess/request.cpp @@ -102,24 +102,24 @@ BOOL DacValidateEEClass(EEClass *pEEClass) // The EEClass method table pointer should match the method table. // TODO: Microsoft, need another test for validity, this one isn't always true anymore. BOOL retval = TRUE; - PAL_CPP_TRY + EX_TRY { MethodTable *pMethodTable = pEEClass->GetMethodTable(); if (!pMethodTable) { // PREfix. - return FALSE; + retval = FALSE; } - if (pEEClass != pMethodTable->GetClass()) + else if (pEEClass != pMethodTable->GetClass()) { retval = FALSE; } } - PAL_CPP_CATCH_ALL + EX_CATCH { retval = FALSE; // Something is wrong } - PAL_CPP_ENDTRY + EX_END_CATCH(SwallowAllExceptions) return retval; } @@ -128,7 +128,7 @@ BOOL DacValidateMethodTable(MethodTable *pMT, BOOL &bIsFree) { // Verify things are right. BOOL retval = FALSE; - PAL_CPP_TRY + EX_TRY { bIsFree = FALSE; EEClass *pEEClass = pMT->GetClass(); @@ -169,11 +169,11 @@ BOOL DacValidateMethodTable(MethodTable *pMT, BOOL &bIsFree) BadMethodTable: ; } - PAL_CPP_CATCH_ALL + EX_CATCH { retval = FALSE; // Something is wrong } - PAL_CPP_ENDTRY + EX_END_CATCH(SwallowAllExceptions) return retval; } @@ -187,7 +187,7 @@ BOOL DacValidateMD(MethodDesc * pMD) // Verify things are right. BOOL retval = TRUE; - PAL_CPP_TRY + EX_TRY { MethodTable *pMethodTable = pMD->GetMethodTable(); @@ -232,11 +232,11 @@ BOOL DacValidateMD(MethodDesc * pMD) } } } - PAL_CPP_CATCH_ALL + EX_CATCH { retval = FALSE; // Something is wrong } - PAL_CPP_ENDTRY + EX_END_CATCH(SwallowAllExceptions) return retval; } @@ -1231,11 +1231,11 @@ ClrDataAccess::GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, MethodDesc* pMD = PTR_MethodDesc(TO_TADDR(methodDesc)); StackSString str; - PAL_CPP_TRY + EX_TRY { TypeString::AppendMethodInternal(str, pMD, TypeString::FormatSignature|TypeString::FormatNamespace|TypeString::FormatFullInst); } - PAL_CPP_CATCH_ALL + EX_CATCH { hr = E_FAIL; if (pMD->IsDynamicMethod()) @@ -1292,7 +1292,7 @@ ClrDataAccess::GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, #endif } } - PAL_CPP_ENDTRY + EX_END_CATCH(SwallowAllExceptions) if (SUCCEEDED(hr)) { @@ -1691,7 +1691,7 @@ ClrDataAccess::GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, __out_ { StackSString s; #ifdef FEATURE_MINIMETADATA_IN_TRIAGEDUMPS - PAL_CPP_TRY + EX_TRY { #endif // FEATURE_MINIMETADATA_IN_TRIAGEDUMPS @@ -1699,14 +1699,14 @@ ClrDataAccess::GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, __out_ #ifdef FEATURE_MINIMETADATA_IN_TRIAGEDUMPS } - PAL_CPP_CATCH_ALL + EX_CATCH { if (!MdCacheGetEEName(dac_cast<TADDR>(pMT), s)) { - PAL_CPP_RETHROW; + EX_RETHROW; } } - PAL_CPP_ENDTRY + EX_END_CATCH(SwallowAllExceptions) #endif // FEATURE_MINIMETADATA_IN_TRIAGEDUMPS if (s.IsEmpty()) diff --git a/src/debug/daccess/task.cpp b/src/debug/daccess/task.cpp index 1c3c5fd11a..fe60eae04b 100644 --- a/src/debug/daccess/task.cpp +++ b/src/debug/daccess/task.cpp @@ -346,10 +346,12 @@ ClrDataTask::CreateStackWalk( DAC_ENTER_SUB(m_dac); + ClrDataStackWalk* walkClass = NULL; + EX_TRY { - ClrDataStackWalk* walkClass = - new (nothrow) ClrDataStackWalk(m_dac, m_thread, flags); + walkClass = new (nothrow) ClrDataStackWalk(m_dac, m_thread, flags); + if (!walkClass) { status = E_OUTOFMEMORY; @@ -365,6 +367,11 @@ ClrDataTask::CreateStackWalk( } EX_CATCH { + if (walkClass) + { + delete walkClass; + } + if (!DacExceptionFilter(GET_EXCEPTION(), m_dac, &status)) { EX_RETHROW; |