Quick fix for an use after free.

llvm-svn: 216071
This commit is contained in:
Rafael Espindola 2014-08-20 15:19:37 +00:00
parent 2661dfc7b9
commit 061beab673
1 changed files with 4 additions and 1 deletions

View File

@ -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) {