summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-07-15 14:02:34 (GMT)
committerBrad King <brad.king@kitware.com>2013-07-15 14:20:00 (GMT)
commita20c819f6380ecef1ff7d03cdbc37d6d2d373ae3 (patch)
tree2387c90c5fd2c16a3032aa313c71d258c0e1b661 /Source/cmake.cxx
parentc8adab9e4344a5ef96d902cf11c938d15aff15fc (diff)
downloadCMake-a20c819f6380ecef1ff7d03cdbc37d6d2d373ae3.zip
CMake-a20c819f6380ecef1ff7d03cdbc37d6d2d373ae3.tar.gz
CMake-a20c819f6380ecef1ff7d03cdbc37d6d2d373ae3.tar.bz2
cmake: Fix resource leak reported by cppcheck
Return early in cmake::ReportUndefinedPropertyAccesses if there is no global generator instead of opening a file and leaking the descriptor. Reported-by: Ömer Fadıl USTA <omerusta@gmail.com>
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index fcec068..f6e40ba 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -3667,11 +3667,11 @@ void cmake::RecordPropertyAccess(const char *name,
void cmake::ReportUndefinedPropertyAccesses(const char *filename)
{
+ if(!this->GlobalGenerator)
+ { return; }
FILE *progFile = fopen(filename,"w");
- if (!progFile || !this->GlobalGenerator)
- {
- return;
- }
+ if(!progFile)
+ { return; }
// what are the enabled languages?
std::vector<std::string> enLangs;