summaryrefslogtreecommitdiffstats
path: root/core/parser-cfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/parser-cfg.c')
-rw-r--r--core/parser-cfg.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/parser-cfg.c b/core/parser-cfg.c
index a0e758e6a3..bf97dde010 100644
--- a/core/parser-cfg.c
+++ b/core/parser-cfg.c
@@ -49,8 +49,8 @@ int m_config_parse_config_file(m_config_t *config, const char *conffile)
#define MAX_LINE_LEN 10000
#define MAX_OPT_LEN 1000
#define MAX_PARAM_LEN 1500
- FILE *fp;
- char *line;
+ FILE *fp = NULL;
+ char *line = NULL;
char opt[MAX_OPT_LEN + 1];
char param[MAX_PARAM_LEN + 1];
char c; /* for the "" and '' check */
@@ -86,7 +86,6 @@ int m_config_parse_config_file(m_config_t *config, const char *conffile)
if ((fp = fopen(conffile, "r")) == NULL) {
mp_msg(MSGT_CFGPARSER, MSGL_V, ": %s\n", strerror(errno));
- free(line);
ret = 0;
goto out;
}
@@ -238,9 +237,10 @@ nextline:
;
}
- free(line);
- fclose(fp);
out:
+ free(line);
+ if (fp)
+ fclose(fp);
config->mode = prev_mode;
--recursion_depth;
if (ret < 0) {