r207075 - Fix two leaks found by LSan (one is test-only).
Nico Weber
nicolasweber at gmx.de
Wed Apr 23 21:58:41 PDT 2014
Author: nico
Date: Wed Apr 23 23:58:41 2014
New Revision: 207075
URL: http://llvm.org/viewvc/llvm-project?rev=207075&view=rev
Log:
Fix two leaks found by LSan (one is test-only).
The result of llvm::MemoryBuffer::getMemBuffer() needs to be freed. Don't
pass "don't free" flag to overrideFileContents() to fix.
Modified:
cfe/trunk/lib/Index/SimpleFormatContext.h
cfe/trunk/unittests/Tooling/RewriterTestContext.h
Modified: cfe/trunk/lib/Index/SimpleFormatContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/SimpleFormatContext.h?rev=207075&r1=207074&r2=207075&view=diff
==============================================================================
--- cfe/trunk/lib/Index/SimpleFormatContext.h (original)
+++ cfe/trunk/lib/Index/SimpleFormatContext.h Wed Apr 23 23:58:41 2014
@@ -51,7 +51,7 @@ public:
llvm::MemoryBuffer::getMemBuffer(Content);
const FileEntry *Entry =
Files.getVirtualFile(Name, Source->getBufferSize(), 0);
- Sources.overrideFileContents(Entry, Source, true);
+ Sources.overrideFileContents(Entry, Source);
assert(Entry != NULL);
return Sources.createFileID(Entry, SourceLocation(), SrcMgr::C_User);
}
Modified: cfe/trunk/unittests/Tooling/RewriterTestContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RewriterTestContext.h?rev=207075&r1=207074&r2=207075&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/RewriterTestContext.h (original)
+++ cfe/trunk/unittests/Tooling/RewriterTestContext.h Wed Apr 23 23:58:41 2014
@@ -52,7 +52,7 @@ class RewriterTestContext {
llvm::MemoryBuffer::getMemBuffer(Content);
const FileEntry *Entry =
Files.getVirtualFile(Name, Source->getBufferSize(), 0);
- Sources.overrideFileContents(Entry, Source, true);
+ Sources.overrideFileContents(Entry, Source);
assert(Entry != NULL);
return Sources.createFileID(Entry, SourceLocation(), SrcMgr::C_User);
}
More information about the cfe-commits
mailing list