Quick fix for an use after free.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216071 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-08-20 15:19:37 +00:00
parent 0ea6d4421c
commit 4b67b5a958

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