diff --git a/include/llvm/Support/IRReader.h b/include/llvm/Support/IRReader.h index fe47c057558..3da6e85e25c 100644 --- a/include/llvm/Support/IRReader.h +++ b/include/llvm/Support/IRReader.h @@ -79,10 +79,10 @@ namespace llvm { (const unsigned char *)Buffer->getBufferEnd())) { std::string ErrMsg; Module *M = ParseBitcodeFile(Buffer, Context, &ErrMsg); - // ParseBitcodeFile does not take ownership of the Buffer. - delete Buffer; if (M == 0) Err = SMDiagnostic(Buffer->getBufferIdentifier(), ErrMsg); + // ParseBitcodeFile does not take ownership of the Buffer. + delete Buffer; return M; }