Skip to content

Commit

Permalink
Fix memory leaked caused by Marshal.GetFunctionPointerForDelegate (do…
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronRobinsonMSFT authored Aug 11, 2020
1 parent d7c967a commit f897710
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
7 changes: 7 additions & 0 deletions src/vm/dllimportcallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,11 +961,18 @@ void UMEntryThunk::Terminate()
CONTRACTL
{
NOTHROW;
MODE_ANY;
}
CONTRACTL_END;

m_code.Poison();

if (GetObjectHandle())
{
DestroyLongWeakHandle(GetObjectHandle());
m_pObjectHandle = 0;
}

s_thunkFreeList.AddToList(this);
}

Expand Down
16 changes: 0 additions & 16 deletions src/vm/dllimportcallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,22 +310,6 @@ class UMEntryThunk
#endif
}

~UMEntryThunk()
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;

if (GetObjectHandle())
{
DestroyLongWeakHandle(GetObjectHandle());
}
}

void Terminate();

VOID RunTimeInit()
Expand Down

0 comments on commit f897710

Please sign in to comment.