Commit c49c69d6 authored by Jonathan Neuschäfer's avatar Jonathan Neuschäfer Committed by Max Kellermann

conf: add missing fclose in error path

This patch seems a bit ugly, maybe it would be a bit cleaner with gotos.
parent d5684f74
...@@ -367,6 +367,7 @@ config_read_file(const char *file, GError **error_r) ...@@ -367,6 +367,7 @@ config_read_file(const char *file, GError **error_r)
assert(*line != 0); assert(*line != 0);
g_propagate_prefixed_error(error_r, error, g_propagate_prefixed_error(error_r, error,
"line %i: ", count); "line %i: ", count);
fclose(fp);
return false; return false;
} }
...@@ -378,6 +379,7 @@ config_read_file(const char *file, GError **error_r) ...@@ -378,6 +379,7 @@ config_read_file(const char *file, GError **error_r)
g_set_error(error_r, config_quark(), 0, g_set_error(error_r, config_quark(), 0,
"unrecognized parameter in config file at " "unrecognized parameter in config file at "
"line %i: %s\n", count, name); "line %i: %s\n", count, name);
fclose(fp);
return false; return false;
} }
...@@ -387,6 +389,7 @@ config_read_file(const char *file, GError **error_r) ...@@ -387,6 +389,7 @@ config_read_file(const char *file, GError **error_r)
"config parameter \"%s\" is first defined " "config parameter \"%s\" is first defined "
"on line %i and redefined on line %i\n", "on line %i and redefined on line %i\n",
name, param->line, count); name, param->line, count);
fclose(fp);
return false; return false;
} }
...@@ -398,6 +401,7 @@ config_read_file(const char *file, GError **error_r) ...@@ -398,6 +401,7 @@ config_read_file(const char *file, GError **error_r)
if (*line != '{') { if (*line != '{') {
g_set_error(error_r, config_quark(), 0, g_set_error(error_r, config_quark(), 0,
"line %i: '{' expected", count); "line %i: '{' expected", count);
fclose(fp);
return false; return false;
} }
...@@ -406,12 +410,15 @@ config_read_file(const char *file, GError **error_r) ...@@ -406,12 +410,15 @@ config_read_file(const char *file, GError **error_r)
g_set_error(error_r, config_quark(), 0, g_set_error(error_r, config_quark(), 0,
"line %i: Unknown tokens after '{'", "line %i: Unknown tokens after '{'",
count); count);
fclose(fp);
return false; return false;
} }
param = config_read_block(fp, &count, string, error_r); param = config_read_block(fp, &count, string, error_r);
if (param == NULL) if (param == NULL) {
fclose(fp);
return false; return false;
}
} else { } else {
/* a string value */ /* a string value */
...@@ -428,6 +435,7 @@ config_read_file(const char *file, GError **error_r) ...@@ -428,6 +435,7 @@ config_read_file(const char *file, GError **error_r)
g_error_free(error); g_error_free(error);
} }
fclose(fp);
return false; return false;
} }
...@@ -435,6 +443,7 @@ config_read_file(const char *file, GError **error_r) ...@@ -435,6 +443,7 @@ config_read_file(const char *file, GError **error_r)
g_set_error(error_r, config_quark(), 0, g_set_error(error_r, config_quark(), 0,
"line %i: Unknown tokens after value", "line %i: Unknown tokens after value",
count); count);
fclose(fp);
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment