Skip to content

Commit

Permalink
Misc #308: Close config file after using it
Browse files Browse the repository at this point in the history
Misc #308: Close the config file after using it, instead of leaving it
open forever. Thanks to SyedAmerGilani for the report.
  • Loading branch information
richardgv committed Sep 22, 2015
1 parent d7f95b5 commit 2343e4b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/compton.c
Original file line number Diff line number Diff line change
Expand Up @@ -5466,12 +5466,17 @@ parse_config(session_t *ps, struct options_tmp *pcfgtmp) {
}
#endif

if (CONFIG_FALSE == config_read(&cfg, f)) {
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;
{
int read_result = config_read(&cfg, f);
fclose(f);
f = NULL;
if (CONFIG_FALSE == read_result) {
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);

Expand Down

0 comments on commit 2343e4b

Please sign in to comment.