diff --git a/lib/Target/TargetMachineC.cpp b/lib/Target/TargetMachineC.cpp index 9fccfcd9e22..2bb0f4c3e9a 100644 --- a/lib/Target/TargetMachineC.cpp +++ b/lib/Target/TargetMachineC.cpp @@ -205,11 +205,11 @@ LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M, char* Filename, LLVMCodeGenFileType codegen, char** ErrorMessage) { std::string error; raw_fd_ostream dest(Filename, error, sys::fs::F_Binary); - formatted_raw_ostream destf(dest); if (!error.empty()) { *ErrorMessage = strdup(error.c_str()); return true; } + formatted_raw_ostream destf(dest); bool Result = LLVMTargetMachineEmit(T, M, destf, codegen, ErrorMessage); dest.flush(); return Result;