diff options
author | David Cole <david.cole@kitware.com> | 2009-10-30 14:31:54 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2009-10-30 14:31:54 (GMT) |
commit | 43d07f6620df4ab98f1cff56c0c2cc5262df08e0 (patch) | |
tree | 20f9a909c842ee9334afa253b01588d9deeb1220 /Source/CPack/cmCPackTarCompressGenerator.cxx | |
parent | 5c594b6f3a76542de13dcae1974689b21e7f25c2 (diff) | |
download | CMake-43d07f6620df4ab98f1cff56c0c2cc5262df08e0.zip CMake-43d07f6620df4ab98f1cff56c0c2cc5262df08e0.tar.gz CMake-43d07f6620df4ab98f1cff56c0c2cc5262df08e0.tar.bz2 |
Fix more mismatched new[] / delete[] (eliminate invalid auto_ptr use) to correct valgrind reported memory issues.
Diffstat (limited to 'Source/CPack/cmCPackTarCompressGenerator.cxx')
-rw-r--r-- | Source/CPack/cmCPackTarCompressGenerator.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index d7513b6..165c181 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -23,7 +23,6 @@ #include <cmsys/SystemTools.hxx> #include <cmcompress/cmcompress.h> #include <libtar/libtar.h> -#include <memory> // auto_ptr #include <fcntl.h> #include <errno.h> @@ -165,9 +164,8 @@ int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName, &mydata }; - // Ok, this libtar is not const safe. for now use auto_ptr hack + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; - std::auto_ptr<char> realNamePtr(realName); strcpy(realName, outFileName); int flags = O_WRONLY | O_CREAT; int options = 0; @@ -185,9 +183,12 @@ int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName, { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): " << strerror(errno) << std::endl); + delete [] realName; return 0; } + delete [] realName; + std::vector<std::string>::const_iterator fileIt; for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) { |