Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 4b67b5a

Browse files
committed
Quick fix for an use after free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216071 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 0ea6d44 commit 4b67b5a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/lli/lli.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,14 +529,17 @@ int main(int argc, char **argv, char * const *envp) {
529529
EE->addModule(std::move(XMod));
530530
}
531531

532+
std::vector<std::unique_ptr<MemoryBuffer>> Buffers;
532533
for (unsigned i = 0, e = ExtraObjects.size(); i != e; ++i) {
533534
ErrorOr<object::OwningBinary<object::ObjectFile>> Obj =
534535
object::ObjectFile::createObjectFile(ExtraObjects[i]);
535536
if (!Obj) {
536537
Err.print(argv[0], errs());
537538
return 1;
538539
}
539-
EE->addObjectFile(std::move(Obj.get().getBinary()));
540+
object::OwningBinary<object::ObjectFile> &O = Obj.get();
541+
EE->addObjectFile(std::move(O.getBinary()));
542+
Buffers.push_back(std::move(O.getBuffer()));
540543
}
541544

542545
for (unsigned i = 0, e = ExtraArchives.size(); i != e; ++i) {

0 commit comments

Comments
 (0)