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
This commit is contained in:
Duncan P. N. Exon Smith 2014-07-30 16:50:22 +00:00
parent 4366b6cede
commit e188fa672b

View File

@ -137,7 +137,7 @@ std::unique_ptr<Module> TempFile::readBitcode(LLVMContext &Context) const {
}
std::unique_ptr<MemoryBuffer> Buffer = std::move(BufferOr.get());
ErrorOr<Module *> ModuleOr = parseBitcodeFile(Buffer.release(), Context);
ErrorOr<Module *> ModuleOr = parseBitcodeFile(Buffer.get(), Context);
if (!ModuleOr) {
DEBUG(dbgs() << "error: " << ModuleOr.getError().message() << "\n");
return nullptr;