From 1f7b913611b3cb30b6e153915aa79a48006ee936 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 24 Apr 2014 04:58:41 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207075 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/SimpleFormatContext.h | 2 +- unittests/Tooling/RewriterTestContext.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Index/SimpleFormatContext.h b/lib/Index/SimpleFormatContext.h index fde43aed21..99d0d9a1ce 100644 --- a/lib/Index/SimpleFormatContext.h +++ b/lib/Index/SimpleFormatContext.h @@ -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); } diff --git a/unittests/Tooling/RewriterTestContext.h b/unittests/Tooling/RewriterTestContext.h index a1bb2311c5..f02ba1a9ff 100644 --- a/unittests/Tooling/RewriterTestContext.h +++ b/unittests/Tooling/RewriterTestContext.h @@ -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); } -- 2.40.0