summaryrefslogtreecommitdiff
path: root/tools/gold/gold-plugin.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2010-06-07 21:42:19 +0000
committerNick Lewycky <nicholas@mxc.ca>2010-06-07 21:42:19 +0000
commit221aec60a7feb5fa14e7c2539617909855623ac1 (patch)
tree7a5ff128716c0c096833e5054b2bbee2d6c14ada /tools/gold/gold-plugin.cpp
parent66f360e990fd54ba1ea02e1ad66e2551cdb519af (diff)
downloadllvm-221aec60a7feb5fa14e7c2539617909855623ac1.tar.gz
llvm-221aec60a7feb5fa14e7c2539617909855623ac1.tar.bz2
llvm-221aec60a7feb5fa14e7c2539617909855623ac1.tar.xz
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
Diffstat (limited to 'tools/gold/gold-plugin.cpp')
-rw-r--r--tools/gold/gold-plugin.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index 3f0b55597a..2b055a2272 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -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);