From 4ecf2cc5eae546861bcf614f4d12c2cd887038a5 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Mon, 7 Jun 2010 21:42:19 +0000 Subject: [PATCH] Plug a leak in the non-error case by removing one level of indirection. llvm-svn: 105556 --- llvm/tools/gold/gold-plugin.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 3f0b55597af4..2b055a2272fe 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/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);