From 4fcf0c7b29cf1603eee6c103f71c1a6b2f833dfc Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 24 Apr 2014 04:26:18 +0000 Subject: Fix two test-only leaks found by LSan. The result of getBufferForFile() must be freed. (Should we change functions that expect the caller to assume ownership so that they return unique_ptrs instead? Then the type system makes sure we get this right.) llvm-svn: 207074 --- clang/unittests/Tooling/RefactoringTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/unittests/Tooling/RefactoringTest.cpp') diff --git a/clang/unittests/Tooling/RefactoringTest.cpp b/clang/unittests/Tooling/RefactoringTest.cpp index 8c7bfa1c767..b1ed3c72be8 100644 --- a/clang/unittests/Tooling/RefactoringTest.cpp +++ b/clang/unittests/Tooling/RefactoringTest.cpp @@ -252,7 +252,9 @@ public: // descriptor, which might not see the changes made. // FIXME: Figure out whether there is a way to get the SourceManger to // reopen the file. - return Context.Files.getBufferForFile(Path, NULL)->getBuffer(); + std::unique_ptr FileBuffer( + Context.Files.getBufferForFile(Path, NULL)); + return FileBuffer->getBuffer(); } llvm::StringMap TemporaryFiles; -- cgit v1.2.3