Skip to content

Commit

Permalink
Don't free the loader handle if the LoaderAllocator is already dead. (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
jkoritzinsky committed Jun 18, 2019
1 parent 96e07e6 commit 342327a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/vm/custommarshalerinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,14 @@ CustomMarshalerInfo::~CustomMarshalerInfo()
{
WRAPPER_NO_CONTRACT;
#ifndef CROSSGEN_COMPILE
if (m_hndCustomMarshaler)
if (m_pLoaderAllocator->IsAlive() && m_hndCustomMarshaler)
{
// Only free the LOADERHANDLE if the LoaderAllocator is still alive.
// If the loader allocator isn't alive, the handle has automatically
// been collected already.
m_pLoaderAllocator->FreeHandle(m_hndCustomMarshaler);
m_hndCustomMarshaler = NULL;
}
m_hndCustomMarshaler = NULL;
#endif
}

Expand Down

0 comments on commit 342327a

Please sign in to comment.