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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105556 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky
2010-06-07 21:42:19 +00:00
parent 66f360e990
commit 221aec60a7

View File

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