summaryrefslogtreecommitdiffstats
path: root/Source/cmExportLibraryDependencies.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-03-16 19:14:15 (GMT)
committerBrad King <brad.king@kitware.com>2006-03-16 19:14:15 (GMT)
commit180a45c8c752c01ee81b8f7ac6aaaf8053f57d0e (patch)
tree26780708545f6917aa6d9828d096ec3ec2bc2549 /Source/cmExportLibraryDependencies.cxx
parent3b43c29a30b154cedd3f983b34bb5e1461832349 (diff)
downloadCMake-180a45c8c752c01ee81b8f7ac6aaaf8053f57d0e.zip
CMake-180a45c8c752c01ee81b8f7ac6aaaf8053f57d0e.tar.gz
CMake-180a45c8c752c01ee81b8f7ac6aaaf8053f57d0e.tar.bz2
BUG: Do not leak the ofstream object in append mode. Just use an auto_ptr for both cases.
Diffstat (limited to 'Source/cmExportLibraryDependencies.cxx')
-rw-r--r--Source/cmExportLibraryDependencies.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx
index 3f39920..7dab940 100644
--- a/Source/cmExportLibraryDependencies.cxx
+++ b/Source/cmExportLibraryDependencies.cxx
@@ -57,21 +57,19 @@ void cmExportLibraryDependenciesCommand::FinalPass()
}
// Use copy-if-different if not appending.
- std::ostream* foutPtr;
- std::auto_ptr<cmGeneratedFileStream> foutNew;
+ std::auto_ptr<std::ofstream> foutPtr;
if(append)
{
- foutPtr = new std::ofstream(fname.c_str(), std::ios::app);
+ foutPtr.reset(new std::ofstream(fname.c_str(), std::ios::app));
}
else
{
std::auto_ptr<cmGeneratedFileStream> ap(
new cmGeneratedFileStream(fname.c_str(), true));
ap->SetCopyIfDifferent(true);
- foutNew = ap;
- foutPtr = foutNew.get();
+ foutPtr.reset(ap.release());
}
- std::ostream& fout = *foutPtr;
+ std::ostream& fout = *foutPtr.get();
if (!fout)
{