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>
This commit is contained in:
Brad King 2013-07-15 10:02:34 -04:00
parent c8adab9e43
commit a20c819f63

View File

@ -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;