teemperor created this revision. Herald added a reviewer: javed.absar. Herald added subscribers: chrib, kristof.beyls.
FastDemangle gives us a C-string that we own (which is allocated in SymbolDemangler::GetDemangledCopy). As we are not deleting the string, we leak memory whenever we call SubsPrimitiveParmItanium. https://reviews.llvm.org/D47418 Files: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp Index: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp =================================================================== --- source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -309,13 +309,15 @@ // FastDemangle will call our hook for each instance of a primitive type, // allowing us to perform substitution - const char *const demangled = + char *const demangled = FastDemangle(mangled.str().c_str(), mangled.size(), swap_parms_hook); if (log) log->Printf("substituted mangling for %s:{%s} %s:{%s}\n", mangled.str().c_str(), demangled, output_buf.c_str(), FastDemangle(output_buf.c_str())); + // FastDemangle malloc'd this string. + free(demangled); return output_buf == mangled ? ConstString() : ConstString(output_buf); }
Index: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp =================================================================== --- source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -309,13 +309,15 @@ // FastDemangle will call our hook for each instance of a primitive type, // allowing us to perform substitution - const char *const demangled = + char *const demangled = FastDemangle(mangled.str().c_str(), mangled.size(), swap_parms_hook); if (log) log->Printf("substituted mangling for %s:{%s} %s:{%s}\n", mangled.str().c_str(), demangled, output_buf.c_str(), FastDemangle(output_buf.c_str())); + // FastDemangle malloc'd this string. + free(demangled); return output_buf == mangled ? ConstString() : ConstString(output_buf); }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits