diff --git a/lldb/include/lldb/Core/RichManglingContext.h b/lldb/include/lldb/Core/RichManglingContext.h --- a/lldb/include/lldb/Core/RichManglingContext.h +++ b/lldb/include/lldb/Core/RichManglingContext.h @@ -29,7 +29,7 @@ m_ipd_buf[0] = '\0'; } - ~RichManglingContext() { std::free(m_ipd_buf); } + ~RichManglingContext(); /// Use the ItaniumPartialDemangler to obtain rich mangling information from /// the given mangled name. diff --git a/lldb/source/Core/RichManglingContext.cpp b/lldb/source/Core/RichManglingContext.cpp --- a/lldb/source/Core/RichManglingContext.cpp +++ b/lldb/source/Core/RichManglingContext.cpp @@ -19,6 +19,15 @@ using namespace lldb_private; // RichManglingContext +RichManglingContext::~RichManglingContext() { + std::free(m_ipd_buf); + if (m_cxx_method_parser.hasValue()) { + assert(m_provider == PluginCxxLanguage); + delete get(m_cxx_method_parser); + m_cxx_method_parser.reset(); + } +} + void RichManglingContext::ResetProvider(InfoProvider new_provider) { // If we want to support parsers for other languages some day, we need a // switch here to delete the correct parser type.