<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 23, 2014 at 2:41 PM, Nico Weber <span dir="ltr"><<a href="mailto:nicolasweber@gmx.de" target="_blank">nicolasweber@gmx.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: nico<br>
Date: Wed Apr 23 16:41:51 2014<br>
New Revision: 207031<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=207031&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=207031&view=rev</a><br>
Log:<br>
Fix leak introduced in r194610, found by LSan.<br>
<br>
LSan folks: LSan pointed to<br>
#0 0x4953e0 in operator new[](unsigned long) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:64<br>
#1 0x7fb82af5372f in clang::RewriteRope::MakeRopeString(char const*, char const*) llvm/tools/clang/lib/Rewrite/Core/RewriteRope.cpp:796<br>
instead of to the actual leak, which made tracking this down slower than<br>
it could have been.<br>
<br>
Modified:<br>
cfe/trunk/include/clang/Index/CommentToXML.h<br>
cfe/trunk/lib/Index/CommentToXML.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Index/CommentToXML.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Index/CommentToXML.h?rev=207031&r1=207030&r2=207031&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Index/CommentToXML.h?rev=207031&r1=207030&r2=207031&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Index/CommentToXML.h (original)<br>
+++ cfe/trunk/include/clang/Index/CommentToXML.h Wed Apr 23 16:41:51 2014<br>
@@ -29,6 +29,7 @@ class CommentToXMLConverter {<br>
<br>
public:<br>
CommentToXMLConverter() : FormatContext(0), FormatInMemoryUniqueId(0) {}<br>
+ ~CommentToXMLConverter();<br>
<br>
void convertCommentToHTML(const comments::FullComment *FC,<br>
SmallVectorImpl<char> &HTML,<br>
<br>
Modified: cfe/trunk/lib/Index/CommentToXML.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/CommentToXML.cpp?rev=207031&r1=207030&r2=207031&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/CommentToXML.cpp?rev=207031&r1=207030&r2=207031&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Index/CommentToXML.cpp (original)<br>
+++ cfe/trunk/lib/Index/CommentToXML.cpp Wed Apr 23 16:41:51 2014<br>
@@ -1136,6 +1136,10 @@ void CommentASTToXMLConverter::appendToR<br>
Result << "]]>";<br>
}<br>
<br>
+CommentToXMLConverter::~CommentToXMLConverter() {<br>
+ delete FormatContext;<br></blockquote><div><br></div><div>Is it possible to use unique_ptr here?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+}<br>
+<br>
void CommentToXMLConverter::convertCommentToHTML(const FullComment *FC,<br>
SmallVectorImpl<char> &HTML,<br>
const ASTContext &Context) {<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>