Skip to content

Commit e188fa6

Browse files
committed
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
1 parent 4366b6c commit e188fa6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/llvm-uselistorder/llvm-uselistorder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ std::unique_ptr<Module> TempFile::readBitcode(LLVMContext &Context) const {
137137
}
138138

139139
std::unique_ptr<MemoryBuffer> Buffer = std::move(BufferOr.get());
140-
ErrorOr<Module *> ModuleOr = parseBitcodeFile(Buffer.release(), Context);
140+
ErrorOr<Module *> ModuleOr = parseBitcodeFile(Buffer.get(), Context);
141141
if (!ModuleOr) {
142142
DEBUG(dbgs() << "error: " << ModuleOr.getError().message() << "\n");
143143
return nullptr;

0 commit comments

Comments
 (0)