]> granicus.if.org Git - clang/commitdiff
Fix leak introduced in r194610, found by LSan.
authorNico Weber <nicolasweber@gmx.de>
Wed, 23 Apr 2014 21:41:51 +0000 (21:41 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 23 Apr 2014 21:41:51 +0000 (21:41 +0000)
LSan folks: LSan pointed to
    #0 0x4953e0 in operator new[](unsigned long) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:64
    #1 0x7fb82af5372f in clang::RewriteRope::MakeRopeString(char const*, char const*) llvm/tools/clang/lib/Rewrite/Core/RewriteRope.cpp:796
instead of to the actual leak, which made tracking this down slower than
it could have been.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207031 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Index/CommentToXML.h
lib/Index/CommentToXML.cpp

index 8444b145343f88c61f44a864864ac5ec15c3e205..c68d7a47d51151d4ce9dc1e7adbd3153cf037fb8 100644 (file)
@@ -29,6 +29,7 @@ class CommentToXMLConverter {
 
 public:
   CommentToXMLConverter() : FormatContext(0), FormatInMemoryUniqueId(0) {}
+  ~CommentToXMLConverter();
 
   void convertCommentToHTML(const comments::FullComment *FC,
                             SmallVectorImpl<char> &HTML,
index 4f5c0745d7279801d9fa210a79798fe6e00202fe..54087bd87d75ceceba00b3d57a59148b74ccc32f 100644 (file)
@@ -1136,6 +1136,10 @@ void CommentASTToXMLConverter::appendToResultWithCDATAEscaping(StringRef S) {
   Result << "]]>";
 }
 
+CommentToXMLConverter::~CommentToXMLConverter() {
+  delete FormatContext;
+}
+
 void CommentToXMLConverter::convertCommentToHTML(const FullComment *FC,
                                                  SmallVectorImpl<char> &HTML,
                                                  const ASTContext &Context) {