diff --git a/utils/HelpGen/src/scriptbinder.cpp b/utils/HelpGen/src/scriptbinder.cpp index 0fbc6d6b72..13c21ee142 100644 --- a/utils/HelpGen/src/scriptbinder.cpp +++ b/utils/HelpGen/src/scriptbinder.cpp @@ -593,7 +593,11 @@ bool DocGeneratorBase::SaveDocument( const char* fname, ScriptStream stm; // check if derived class agrees about saving it - if ( !OnSaveDocument( stm ) ) return 0; + if ( !OnSaveDocument( stm ) ) + { + fclose( fp ); + return 0; + } if ( pFromSection )