diff options
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | 2011-07-18 12:38:43 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-07-18 22:03:40 +0200 |
commit | c49c69d6ea0b7670f70066f0735fcffc69966d46 (patch) | |
tree | 64485630dea8b7eaece71dc09d6f8c656945b16c /src | |
parent | d5684f74440fec77b3bc7c80a8396c79e4e489ee (diff) | |
download | mpd-c49c69d6ea0b7670f70066f0735fcffc69966d46.tar.gz mpd-c49c69d6ea0b7670f70066f0735fcffc69966d46.tar.xz mpd-c49c69d6ea0b7670f70066f0735fcffc69966d46.zip |
conf: add missing fclose in error path
This patch seems a bit ugly, maybe it would be a bit cleaner with gotos.
Diffstat (limited to 'src')
-rw-r--r-- | src/conf.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/conf.c b/src/conf.c index 705942085..14dac93a6 100644 --- a/src/conf.c +++ b/src/conf.c @@ -367,6 +367,7 @@ config_read_file(const char *file, GError **error_r) assert(*line != 0); g_propagate_prefixed_error(error_r, error, "line %i: ", count); + fclose(fp); return false; } @@ -378,6 +379,7 @@ config_read_file(const char *file, GError **error_r) g_set_error(error_r, config_quark(), 0, "unrecognized parameter in config file at " "line %i: %s\n", count, name); + fclose(fp); return false; } @@ -387,6 +389,7 @@ config_read_file(const char *file, GError **error_r) "config parameter \"%s\" is first defined " "on line %i and redefined on line %i\n", name, param->line, count); + fclose(fp); return false; } @@ -398,6 +401,7 @@ config_read_file(const char *file, GError **error_r) if (*line != '{') { g_set_error(error_r, config_quark(), 0, "line %i: '{' expected", count); + fclose(fp); return false; } @@ -406,12 +410,15 @@ config_read_file(const char *file, GError **error_r) g_set_error(error_r, config_quark(), 0, "line %i: Unknown tokens after '{'", count); + fclose(fp); return false; } param = config_read_block(fp, &count, string, error_r); - if (param == NULL) + if (param == NULL) { + fclose(fp); return false; + } } else { /* a string value */ @@ -428,6 +435,7 @@ config_read_file(const char *file, GError **error_r) g_error_free(error); } + fclose(fp); return false; } @@ -435,6 +443,7 @@ config_read_file(const char *file, GError **error_r) g_set_error(error_r, config_quark(), 0, "line %i: Unknown tokens after value", count); + fclose(fp); return false; } |