core: rconf: fix leak when config fails (CID 165165)
@@ -240,6 +240,7 @@ static int mk_rconf_read(struct mk_rconf *conf, const char *path)
ret = mk_rconf_read(conf, buf + 9);
if (ret == -1) {
conf->level--;
+ fclose(f);
return -1;
}
continue;
@@ -247,6 +248,7 @@ static int mk_rconf_read(struct mk_rconf *conf, const char *path)
else if (buf[0] == '@' && len > 3) {
ret = mk_rconf_meta_add(conf, buf, len);
if (ret == -1) {
+ fclose(f);
return -1;
}
continue;
