Plug a leak in the non-error case by removing one level of indirection.

llvm-svn: 105556
This commit is contained in:
Nick Lewycky 2010-06-07 21:42:19 +00:00
parent 6201b991a2
commit 4ecf2cc5ea
1 changed files with 4 additions and 6 deletions

View File

@ -419,17 +419,15 @@ static ld_plugin_status all_symbols_read_hook(void) {
(*message)(LDPL_ERROR, "%s", ErrMsg.c_str());
return LDPS_ERR;
}
raw_fd_ostream *objFile =
new raw_fd_ostream(uniqueObjPath.c_str(), ErrMsg,
raw_fd_ostream::F_Binary);
raw_fd_ostream objFile(uniqueObjPath.c_str(), ErrMsg,
raw_fd_ostream::F_Binary);
if (!ErrMsg.empty()) {
delete objFile;
(*message)(LDPL_ERROR, "%s", ErrMsg.c_str());
return LDPS_ERR;
}
objFile->write(buffer, bufsize);
objFile->close();
objFile.write(buffer, bufsize);
objFile.close();
lto_codegen_dispose(cg);