Misc #308: Close config file after using it
Misc #308: Close the config file after using it, instead of leaving it open forever. Thanks to SyedAmerGilani for the report.
This commit is contained in:
parent
d7f95b56b1
commit
2343e4bbd2
|
@ -5466,12 +5466,17 @@ parse_config(session_t *ps, struct options_tmp *pcfgtmp) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (CONFIG_FALSE == config_read(&cfg, f)) {
|
{
|
||||||
printf("Error when reading configuration file \"%s\", line %d: %s\n",
|
int read_result = config_read(&cfg, f);
|
||||||
path, config_error_line(&cfg), config_error_text(&cfg));
|
fclose(f);
|
||||||
config_destroy(&cfg);
|
f = NULL;
|
||||||
free(path);
|
if (CONFIG_FALSE == read_result) {
|
||||||
return;
|
printf("Error when reading configuration file \"%s\", line %d: %s\n",
|
||||||
|
path, config_error_line(&cfg), config_error_text(&cfg));
|
||||||
|
config_destroy(&cfg);
|
||||||
|
free(path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
config_set_auto_convert(&cfg, 1);
|
config_set_auto_convert(&cfg, 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue