Fix releasing of file handle in binder tracing (#39974)
authorElinor Fung <47805090+elinor-fung@users.noreply.github.com>
Tue, 28 Jul 2020 01:12:25 +0000 (18:12 -0700)
committerGitHub <noreply@github.com>
Tue, 28 Jul 2020 01:12:25 +0000 (18:12 -0700)
src/coreclr/src/binder/bindertracing.cpp

index 2e5c83d..be09ebc 100644 (file)
@@ -216,14 +216,14 @@ namespace BinderTracing
 
     AssemblyBindOperation::~AssemblyBindOperation()
     {
-        if (!BinderTracing::IsEnabled() || ShouldIgnoreBind())
-            return;
-
-        // Make sure the bind request is populated. Tracing may have been enabled mid-bind.
-        if (!m_populatedBindRequest)
-            PopulateBindRequest(m_bindRequest);
+        if (BinderTracing::IsEnabled() && !ShouldIgnoreBind())
+        {
+            // Make sure the bind request is populated. Tracing may have been enabled mid-bind.
+            if (!m_populatedBindRequest)
+                PopulateBindRequest(m_bindRequest);
 
-        FireAssemblyLoadStop(m_bindRequest, m_resultAssembly, m_cached);
+            FireAssemblyLoadStop(m_bindRequest, m_resultAssembly, m_cached);
+        }
 
         if (m_resultAssembly != nullptr)
             m_resultAssembly->Release();