From a20c819f6380ecef1ff7d03cdbc37d6d2d373ae3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 15 Jul 2013 10:02:34 -0400 Subject: [PATCH] cmake: Fix resource leak reported by cppcheck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Source/cmake.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index fcec068b7..f6e40bafc 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 enLangs;