Commit d23a0c37 authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: fix missing fclose() on error paths

The file is not closed when ferror() fails.

Fixes: 00d674cb ("kconfig: refactor conf_write_dep()")
Fixes: 57ddd07c ("kconfig: refactor conf_write_autoconf()")
Reported-by: default avatarRyan Cai <ycaibb@gmail.com>
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent 1cf5f151
......@@ -979,10 +979,10 @@ static int conf_write_autoconf_cmd(const char *autoconf_name)
fprintf(out, "\n$(deps_config): ;\n");
if (ferror(out)) /* error check for all fprintf() calls */
return -1;
ret = ferror(out); /* error check for all fprintf() calls */
fclose(out);
if (ret)
return -1;
if (rename(tmp, name)) {
perror("rename");
......@@ -1093,10 +1093,10 @@ static int __conf_write_autoconf(const char *filename,
print_symbol(file, sym);
/* check possible errors in conf_write_heading() and print_symbol() */
if (ferror(file))
return -1;
ret = ferror(file);
fclose(file);
if (ret)
return -1;
if (rename(tmp, filename)) {
perror("rename");
......
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