This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333353: Fix memory leak in SubsPrimitiveParmItanium 
(authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D47418?vs=148742&id=148743#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47418

Files:
  lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp


Index: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/trunk/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: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/trunk/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
  • [Lldb-commits] [PATCH] D4... Raphael Isemann via Phabricator via lldb-commits
    • [Lldb-commits] [PATC... Raphael Isemann via Phabricator via lldb-commits

Reply via email to