Fix a double free in llvm::getBitcodeTargetTriple.

Unfortunately this is only used by ld64, so no testcase, but should fix the darwin LTO bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216618 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-08-27 21:11:13 +00:00
parent d445e4acdb
commit aa9db69bb5

View File

@ -3588,7 +3588,7 @@ ErrorOr<Module *> llvm::parseBitcodeFile(MemoryBufferRef Buffer,
std::string llvm::getBitcodeTargetTriple(MemoryBufferRef Buffer,
LLVMContext &Context) {
std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(Buffer, false);
auto R = llvm::make_unique<BitcodeReader>(Buf.get(), Context);
auto R = llvm::make_unique<BitcodeReader>(Buf.release(), Context);
ErrorOr<std::string> Triple = R->parseTriple();
if (Triple.getError())
return "";