From: Duncan P. N. Exon Smith Date: Wed, 30 Jul 2014 16:50:22 +0000 (+0000) Subject: llvm-uselistorder: Fix memory leak from r214125 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e188fa672bc2d8ab999971826c4d9f3b11bd8c8e;p=llvm llvm-uselistorder: Fix memory leak from r214125 Turns out `parseBitcodeFile()` does *not* take ownership of the buffer. This was already clear in the header docs, but I obviously didn't read them (having noticed that it gets stored in a `unique_ptr<>`). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214313 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/llvm-uselistorder/llvm-uselistorder.cpp b/tools/llvm-uselistorder/llvm-uselistorder.cpp index c988bbd7d9a..b05416152e2 100644 --- a/tools/llvm-uselistorder/llvm-uselistorder.cpp +++ b/tools/llvm-uselistorder/llvm-uselistorder.cpp @@ -137,7 +137,7 @@ std::unique_ptr TempFile::readBitcode(LLVMContext &Context) const { } std::unique_ptr Buffer = std::move(BufferOr.get()); - ErrorOr ModuleOr = parseBitcodeFile(Buffer.release(), Context); + ErrorOr ModuleOr = parseBitcodeFile(Buffer.get(), Context); if (!ModuleOr) { DEBUG(dbgs() << "error: " << ModuleOr.getError().message() << "\n"); return nullptr;