[llvm] r177822 - Plug a memory leak in FileCheck when the input file is empty.
Benjamin Kramer
benny.kra at googlemail.com
Sat Mar 23 06:56:23 PDT 2013
Author: d0k
Date: Sat Mar 23 08:56:23 2013
New Revision: 177822
URL: http://llvm.org/viewvc/llvm-project?rev=177822&view=rev
Log:
Plug a memory leak in FileCheck when the input file is empty.
Modified:
llvm/trunk/utils/FileCheck/FileCheck.cpp
Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=177822&r1=177821&r2=177822&view=diff
==============================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp Sat Mar 23 08:56:23 2013
@@ -639,11 +639,11 @@ static bool ReadCheckFile(SourceMgr &SM,
<< ec.message() << '\n';
return true;
}
- MemoryBuffer *F = File.take();
// If we want to canonicalize whitespace, strip excess whitespace from the
// buffer containing the CHECK lines. Remove DOS style line endings.
- F = CanonicalizeInputFile(F, NoCanonicalizeWhiteSpace);
+ MemoryBuffer *F =
+ CanonicalizeInputFile(File.take(), NoCanonicalizeWhiteSpace);
SM.AddNewSourceBuffer(F, SMLoc());
@@ -803,16 +803,16 @@ int main(int argc, char **argv) {
<< ec.message() << '\n';
return 2;
}
- MemoryBuffer *F = File.take();
- if (F->getBufferSize() == 0) {
+ if (File->getBufferSize() == 0) {
errs() << "FileCheck error: '" << InputFilename << "' is empty.\n";
return 2;
}
-
+
// Remove duplicate spaces in the input file if requested.
// Remove DOS style line endings.
- F = CanonicalizeInputFile(F, NoCanonicalizeWhiteSpace);
+ MemoryBuffer *F =
+ CanonicalizeInputFile(File.take(), NoCanonicalizeWhiteSpace);
SM.AddNewSourceBuffer(F, SMLoc());
More information about the llvm-commits
mailing list