sst1, sst1InitVoodooFile(): don't leak FILE* pointer in case of failure

This commit is contained in:
sezero
2018-08-24 21:55:50 +03:00
parent db8ef4d0ef
commit dbcbbb1313
4 changed files with 22 additions and 18 deletions

View File

@@ -247,13 +247,13 @@ FX_ENTRY FxBool FX_CALL sst1InitVoodooFile()
if(inCfg) {
if(!sst1InitParseFieldCfg(buffer)) {
if(helper) INIT_PRINTF(("ERROR in %s section of .ini file...\n", "[CFG]"));
if(helper) INIT_PRINTF(("ERROR in %s section of .ini file.\n", "[CFG]"));
retVal = FXFALSE;
break;
}
} else if(inDac) {
if(!sst1InitParseFieldDac(buffer)) {
if(helper) INIT_PRINTF(("ERROR in %s section of .ini file...\n", "[DAC]"));
if(helper) INIT_PRINTF(("ERROR in %s section of .ini file.\n", "[DAC]"));
retVal = FXFALSE;
break;
}

View File

@@ -134,22 +134,24 @@ FX_ENTRY FxBool FX_CALL sst1InitVoodooFile()
}
if(inCfg) {
if(!sst1InitParseFieldCfg(buffer)) {
if(helper)
INIT_PRINTF(("ERROR in %s section of .ini file...\n", "[CFG]"));
return(FXFALSE);
tmpPtr = "[CFG]";
goto _fail;
}
} else if(inDac) {
if(!sst1InitParseFieldDac(buffer)) {
if(helper)
INIT_PRINTF(("ERROR in %s section of .ini file...\n", "[DAC]"));
return(FXFALSE);
tmpPtr = "[DAC]";
goto _fail;
}
}
}
fclose(file);
INIT_PRINTF(("INIT: Using .ini file '%s'\n", filename));
return(FXTRUE);
_fail:
if(helper)
INIT_PRINTF(("ERROR in %s section of .ini file.\n", tmpPtr));
fclose(file);
return(FXFALSE);
#endif
}

View File

@@ -247,13 +247,13 @@ FX_ENTRY FxBool FX_CALL sst1InitVoodooFile()
if(inCfg) {
if(!sst1InitParseFieldCfg(buffer)) {
if(helper) INIT_PRINTF(("ERROR in %s section of .ini file...\n", "[CFG]"));
if(helper) INIT_PRINTF(("ERROR in %s section of .ini file.\n", "[CFG]"));
retVal = FXFALSE;
break;
}
} else if(inDac) {
if(!sst1InitParseFieldDac(buffer)) {
if(helper) INIT_PRINTF(("ERROR in %s section of .ini file...\n", "[DAC]"));
if(helper) INIT_PRINTF(("ERROR in %s section of .ini file.\n", "[DAC]"));
retVal = FXFALSE;
break;
}

View File

@@ -134,22 +134,24 @@ FX_ENTRY FxBool FX_CALL sst1InitVoodooFile()
}
if(inCfg) {
if(!sst1InitParseFieldCfg(buffer)) {
if(helper)
INIT_PRINTF(("ERROR in %s section of .ini file...\n", "[CFG]"));
return(FXFALSE);
tmpPtr = "[CFG]";
goto _fail;
}
} else if(inDac) {
if(!sst1InitParseFieldDac(buffer)) {
if(helper)
INIT_PRINTF(("ERROR in %s section of .ini file...\n", "[DAC]"));
return(FXFALSE);
tmpPtr = "[DAC]";
goto _fail;
}
}
}
fclose(file);
INIT_PRINTF(("INIT: Using .ini file '%s'\n", filename));
return(FXTRUE);
_fail:
if(helper)
INIT_PRINTF(("ERROR in %s section of .ini file.\n", tmpPtr));
fclose(file);
return(FXFALSE);
#endif
}