From 5ba635cddad00e655a94f5df903999ad286126c8 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Tue, 13 Jul 2021 11:00:01 +0200 Subject: [PATCH] Fix UMThunkMarshInfo delete There was a forgotten call to c++ delete that should have been converted to LoaderHeap::BackoutMem in a code path invoked only if two threads raced for allocating the UMThunkMarshInfo and the one that lost the race needed to delete it. --- src/coreclr/vm/comdelegate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/comdelegate.cpp b/src/coreclr/vm/comdelegate.cpp index 1b61e16dec5d3..03cecd838023b 100644 --- a/src/coreclr/vm/comdelegate.cpp +++ b/src/coreclr/vm/comdelegate.cpp @@ -1263,7 +1263,7 @@ LPVOID COMDelegate::ConvertToCallback(OBJECTREF pDelegateObj) pUMThunkMarshInfo, NULL ) != NULL) { - delete pUMThunkMarshInfo; + pMT->GetLoaderAllocator()->GetStubHeap()->BackoutMem(pUMThunkMarshInfo, sizeof(UMThunkMarshInfo)); pUMThunkMarshInfo = pClass->m_pUMThunkMarshInfo; } }