Err, was that code wrong? I malloc it unconditionally, so it should be freed unconditionally (don't have source in front of me, so I'm going from memory)<br><div class="gmail_quote">On Wed, Jan 14, 2015 at 7:36 PM Jim Ingham <<a href="mailto:jingham@apple.com">jingham@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jingham<br>
Date: Wed Jan 14 21:34:31 2015<br>
New Revision: 226088<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=226088&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=226088&view=rev</a><br>
Log:<br>
Fix a little thinko in r226017 - the code to actually add the demangled name to the Mangled object got<br>
moved into the #else branch of the #if/#elif/#endif, so it wasn't getting done in the #if case anymore.<br>
<br>
Keep the code to add the demangled name outside of the #if, and then just free the demangled_name<br>
and set it back to NULL in the Windows case.<br>
<br>
<rdar://problem/19479499><br>
<br>
Modified:<br>
lldb/trunk/source/Core/<u></u>Mangled.cpp<br>
<br>
Modified: lldb/trunk/source/Core/<u></u>Mangled.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Mangled.cpp?rev=226088&r1=226087&r2=226088&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/lldb/trunk/source/<u></u>Core/Mangled.cpp?rev=226088&<u></u>r1=226087&r2=226088&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- lldb/trunk/source/Core/<u></u>Mangled.cpp (original)<br>
+++ lldb/trunk/source/Core/<u></u>Mangled.cpp Wed Jan 14 21:34:31 2015<br>
@@ -5240,18 +5240,20 @@ Mangled::GetDemangledName () const<br>
UNDNAME_NO_MEMBER_TYPE | // Strip virtual, static, etc specifiers<br>
UNDNAME_NO_MS_KEYWORDS // Strip all MS extension keywords<br>
);<br>
- if (result > 0)<br>
- m_demangled.<u></u>SetCStringWithMangledCounterpa<u></u>rt(demangled_name, m_mangled);<br>
- free(demangled_name);<br>
+ if (result == 0)<br>
+ {<br>
+ free (demangled_name);<br>
+ demangled_name = nullptr;<br>
+ }<br>
#else<br>
char *demangled_name = abi::__cxa_demangle (mangled_cstr, NULL, NULL, NULL);<br>
+#endif<br>
<br>
if (demangled_name)<br>
{<br>
m_demangled.<u></u>SetCStringWithMangledCounterpa<u></u>rt(demangled_name, m_mangled);<br>
free (demangled_name);<br>
}<br>
-#endif<br>
}<br>
}<br>
if (!m_demangled)<br>
<br>
<br>
______________________________<u></u>_________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/lldb-commits</a><br>
</blockquote></div>