[Lldb-commits] [PATCH] D47418: Fix memory leak in SubsPrimitiveParmItanium

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun May 27 00:35:14 PDT 2018


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);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47418.148743.patch
Type: text/x-patch
Size: 905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180527/e221f125/attachment.bin>


More information about the lldb-commits mailing list