diff options
author | Nico Weber <nicolasweber@gmx.de> | 2014-04-24 04:26:18 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2014-04-24 04:26:18 +0000 |
commit | 4fcf0c7b29cf1603eee6c103f71c1a6b2f833dfc (patch) | |
tree | e0cba88f72611bd2010c41b09e3cf050136eecf0 /clang/unittests/Tooling/RefactoringTest.cpp | |
parent | 82098cb6dfc80dad8167c6dfbc036eb402ce52ff (diff) | |
download | bcm5719-llvm-4fcf0c7b29cf1603eee6c103f71c1a6b2f833dfc.tar.gz bcm5719-llvm-4fcf0c7b29cf1603eee6c103f71c1a6b2f833dfc.zip |
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
Diffstat (limited to 'clang/unittests/Tooling/RefactoringTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/RefactoringTest.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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<const llvm::MemoryBuffer> FileBuffer( + Context.Files.getBufferForFile(Path, NULL)); + return FileBuffer->getBuffer(); } llvm::StringMap<std::string> TemporaryFiles; |