From d4cbb60d168f9899c68fb8553b16accf018dfdd5 Mon Sep 17 00:00:00 2001 From: Mikhail Pilin Date: Fri, 4 Sep 2020 00:02:58 +0200 Subject: [PATCH] Fix leaking ICorProfilerCallback10. (#41791) --- src/coreclr/src/vm/eetoprofinterfaceimpl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/coreclr/src/vm/eetoprofinterfaceimpl.cpp b/src/coreclr/src/vm/eetoprofinterfaceimpl.cpp index 698dbec..3380865 100644 --- a/src/coreclr/src/vm/eetoprofinterfaceimpl.cpp +++ b/src/coreclr/src/vm/eetoprofinterfaceimpl.cpp @@ -658,6 +658,8 @@ HRESULT EEToProfInterfaceImpl::CreateProfiler( m_hmodProfilerDLL = hmodProfilerDLL.Extract(); hmodProfilerDLL = NULL; + // ATTENTION: Please update EEToProfInterfaceImpl::~EEToProfInterfaceImpl() after adding the next ICorProfilerCallback interface here !!! + // The profiler may optionally support ICorProfilerCallback3,4,5,6,7,8,9,10. Let's check. ReleaseHolder pCallback10; hr = m_pCallback2->QueryInterface( @@ -904,6 +906,12 @@ EEToProfInterfaceImpl::~EEToProfInterfaceImpl() m_pCallback9 = NULL; } + if (m_pCallback10 != NULL) + { + m_pCallback10->Release(); + m_pCallback10 = NULL; + } + // Only unload the V4 profiler if this is not part of shutdown. This protects // Whidbey profilers that aren't used to being FreeLibrary'd. if (fIsV4Profiler && !g_fEEShutDown) -- 2.7.4