[Cmake-commits] [cmake-commits] david.cole committed cmCPackTGZGenerator.cxx 1.21 1.22
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Oct 26 13:49:26 EDT 2009
Update of /cvsroot/CMake/CMake/Source/CPack
In directory public:/mounts/ram/cvs-serv31076/Source/CPack
Modified Files:
cmCPackTGZGenerator.cxx
Log Message:
Correct one of the valgrind errors from the CPackTestAllGenerators test. Do not use auto_ptr on a new [] allocation because auto_ptr does not use delete [].
Index: cmCPackTGZGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackTGZGenerator.cxx,v
retrieving revision 1.21
retrieving revision 1.22
diff -C 2 -d -r1.21 -r1.22
*** cmCPackTGZGenerator.cxx 1 Oct 2009 20:47:08 -0000 1.21
--- cmCPackTGZGenerator.cxx 26 Oct 2009 17:49:20 -0000 1.22
***************
*** 24,28 ****
#include <cm_zlib.h>
#include <libtar/libtar.h>
- #include <memory> // auto_ptr
#include <fcntl.h>
#include <errno.h>
--- 24,27 ----
***************
*** 220,226 ****
};
! // Ok, this libtar is not const safe. for now use auto_ptr hack
char* realName = new char[ strlen(outFileName) + 1 ];
- std::auto_ptr<char> realNamePtr(realName);
strcpy(realName, outFileName);
int flags = O_WRONLY | O_CREAT;
--- 219,224 ----
};
! // Ok, 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;
***************
*** 240,243 ****
--- 238,242 ----
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): "
<< strerror(errno) << std::endl);
+ delete [] realName;
return 0;
}
***************
*** 258,261 ****
--- 257,261 ----
<< strerror(errno) << std::endl);
tar_close(t);
+ delete [] realName;
return 0;
}
***************
*** 266,269 ****
--- 266,270 ----
<< strerror(errno) << std::endl);
tar_close(t);
+ delete [] realName;
return 0;
}
***************
*** 273,278 ****
--- 274,281 ----
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_close(): "
<< strerror(errno) << std::endl);
+ delete [] realName;
return 0;
}
+ delete [] realName;
return 1;
}
More information about the Cmake-commits
mailing list