From 7d9a97ee20ea4e9776d0beecd932548dd1bffaf0 Mon Sep 17 00:00:00 2001 From: Copilot Sandbox Date: Wed, 18 Feb 2026 14:16:31 +0000 Subject: [PATCH] Fix memory leak in ICorDebugEnum::Clone on CordbEnumerator Add cloned enumerator to the process continue neuter list so it gets properly neutered during cleanup. Without this, cloned enumerators leak their internal m_items array and trigger a debug assertion failure (_ASSERTE(IsNeutered())) in the destructor. Fixes #121925 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/coreclr/debug/di/rsenumerator.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/debug/di/rsenumerator.hpp b/src/coreclr/debug/di/rsenumerator.hpp index d9bc2d6181f589..a6b4d2e0838463 100644 --- a/src/coreclr/debug/di/rsenumerator.hpp +++ b/src/coreclr/debug/di/rsenumerator.hpp @@ -213,6 +213,7 @@ HRESULT CordbEnumerator* clone = new CordbEnumerator( GetProcess(), m_items, m_countItems); + GetProcess()->GetContinueNeuterList()->Add(GetProcess(), clone); clone->QueryInterface(__uuidof(ICorDebugEnum), (void**)ppEnum); } EX_CATCH_HRESULT(hr)