Fix a pair of use after free. Should bring the bots back.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216005 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-08-19 18:59:14 +00:00
parent 548f2b6e8f
commit f2b844d0b1

View File

@ -72,7 +72,7 @@ MachOUniversalBinary::ObjectForArch::getAsObjectFile() const {
if (Parent) {
StringRef ParentData = Parent->getData();
StringRef ObjectData = ParentData.substr(Header.offset, Header.size);
StringRef ObjectName = Parent->getFileName().str();
StringRef ObjectName = Parent->getFileName();
MemoryBufferRef ObjBuffer(ObjectData, ObjectName);
return ObjectFile::createMachOObjectFile(ObjBuffer);
}
@ -84,7 +84,7 @@ std::error_code MachOUniversalBinary::ObjectForArch::getAsArchive(
if (Parent) {
StringRef ParentData = Parent->getData();
StringRef ObjectData = ParentData.substr(Header.offset, Header.size);
std::string ObjectName = Parent->getFileName().str();
StringRef ObjectName = Parent->getFileName();
MemoryBufferRef ObjBuffer(ObjectData, ObjectName);
ErrorOr<std::unique_ptr<Archive>> Obj = Archive::create(ObjBuffer);
if (std::error_code EC = Obj.getError())