diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-20 15:19:37 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-20 15:19:37 +0000 |
commit | 4b67b5a95838ba0c33546603a5f4df4400499f6d (patch) | |
tree | bd7b4d18f628b415b35930335feb25bc71f3978d /tools/lli | |
parent | 0ea6d4421cfc8e01c5bfb3552bb3999acc617c31 (diff) |
Quick fix for an use after free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216071 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lli')
-rw-r--r-- | tools/lli/lli.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index c8edf552945..3cf81cafe2f 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -529,6 +529,7 @@ int main(int argc, char **argv, char * const *envp) { EE->addModule(std::move(XMod)); } + std::vector<std::unique_ptr<MemoryBuffer>> Buffers; for (unsigned i = 0, e = ExtraObjects.size(); i != e; ++i) { ErrorOr<object::OwningBinary<object::ObjectFile>> Obj = object::ObjectFile::createObjectFile(ExtraObjects[i]); @@ -536,7 +537,9 @@ int main(int argc, char **argv, char * const *envp) { Err.print(argv[0], errs()); return 1; } - EE->addObjectFile(std::move(Obj.get().getBinary())); + object::OwningBinary<object::ObjectFile> &O = Obj.get(); + EE->addObjectFile(std::move(O.getBinary())); + Buffers.push_back(std::move(O.getBuffer())); } for (unsigned i = 0, e = ExtraArchives.size(); i != e; ++i) { |