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/cmCPackTGZGenerator.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/cmCPackTGZGenerator.cxx')
-rw-r--r-- | Source/CPack/cmCPackTGZGenerator.cxx | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 391093a..99574b0 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -218,7 +218,7 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, &mydata }; - // Ok, this libtar is not const safe. Make a non-const copy of outFileName + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; strcpy(realName, outFileName); int flags = O_WRONLY | O_CREAT; @@ -241,6 +241,8 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, return 0; } + delete [] realName; + std::vector<std::string>::const_iterator fileIt; for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) { @@ -256,7 +258,6 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, << pathname << "\"): " << strerror(errno) << std::endl); tar_close(t); - delete [] realName; return 0; } } @@ -265,7 +266,6 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_append_eof(): " << strerror(errno) << std::endl); tar_close(t); - delete [] realName; return 0; } @@ -273,10 +273,8 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_close(): " << strerror(errno) << std::endl); - delete [] realName; return 0; } - delete [] realName; return 1; } |