summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-09-07 19:37:48 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-09-07 19:37:48 (GMT)
commitf62540adcc1dd53b66534f6ed7c03b5e5daf1d26 (patch)
treedda4fd848e91aba55a924d48a141bef164ad8e74 /Source
parent4558e6eeee3a037b8f885cb883a2adc47231d7a0 (diff)
parentd1751fbf17d2c0e945f696b920fe0cf2a8ad14b2 (diff)
downloadCMake-f62540adcc1dd53b66534f6ed7c03b5e5daf1d26.zip
CMake-f62540adcc1dd53b66534f6ed7c03b5e5daf1d26.tar.gz
CMake-f62540adcc1dd53b66534f6ed7c03b5e5daf1d26.tar.bz2
Merge topic 'fix-errors-from-cppcheck-issue-12440'
d1751fb ccmake: Fix off-by-one memory access error 4868921 Fix file() command descriptor leak on error f47393c CTest: Fix memory leaks on error
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestRunTest.cxx2
-rw-r--r--Source/CTest/cmParsePHPCoverage.cxx1
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx2
-rw-r--r--Source/cmCTest.cxx2
-rw-r--r--Source/cmFileCommand.cxx2
5 files changed, 8 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 60695da..81f18b0 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -93,6 +93,7 @@ void cmCTestRunTest::CompressOutput()
ret = deflateInit(&strm, -1); //default compression level
if (ret != Z_OK)
{
+ delete[] out;
return;
}
@@ -106,6 +107,7 @@ void cmCTestRunTest::CompressOutput()
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Error during output "
"compression. Sending uncompressed output." << std::endl);
+ delete[] out;
return;
}
diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx
index 32c1ec1..593b2d1 100644
--- a/Source/CTest/cmParsePHPCoverage.cxx
+++ b/Source/CTest/cmParsePHPCoverage.cxx
@@ -159,6 +159,7 @@ bool cmParsePHPCoverage::ReadFileInformation(std::ifstream& in)
// read open quote
if(in.get(c) && c != '"')
{
+ delete[] s;
return false;
}
// read the string data
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 1c48d8c..0e2cd22 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -68,7 +68,7 @@ void cmCursesLongMessageForm::UpdateStatusBar()
}
else
{
- width = cmCursesMainForm::MAX_WIDTH;
+ width = cmCursesMainForm::MAX_WIDTH-1;
}
bar[width] = '\0';
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 75a564e..702ba10 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -3096,6 +3096,7 @@ bool cmCTest::CompressString(std::string& str)
ret = deflateInit(&strm, -1); //default compression level
if (ret != Z_OK)
{
+ delete[] out;
return false;
}
@@ -3109,6 +3110,7 @@ bool cmCTest::CompressString(std::string& str)
{
cmCTestLog(this, ERROR_MESSAGE, "Error during gzip compression."
<< std::endl);
+ delete[] out;
return false;
}
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 9a3de9b..3b63906 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2982,6 +2982,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
std::string errStr = "UPLOAD cannot stat file '";
errStr += filename + "'.";
this->SetError(errStr.c_str());
+ fclose(fin);
return false;
}
@@ -2991,6 +2992,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
if(!curl)
{
this->SetError("UPLOAD error initializing curl.");
+ fclose(fin);
return false;
}