aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2020-01-02 16:32:37 +0100
committerFabian Groffen <grobian@gentoo.org>2020-01-02 16:32:37 +0100
commit7f610741388d8543d3d7652de4625eaa7caa6dfd (patch)
tree3aadf06ca12dfabcee3e33326632fca24c301600
parenttravis: try differently to get valgrind to run (diff)
downloadportage-utils-7f610741.tar.gz
portage-utils-7f610741.tar.bz2
portage-utils-7f610741.zip
qcheck: fix use after free
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--qcheck.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/qcheck.c b/qcheck.c
index 1217a8a2..59f35e29 100644
--- a/qcheck.c
+++ b/qcheck.c
@@ -305,7 +305,6 @@ qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv)
}
free(line);
free(buffer);
- fclose(fp_contents);
if (!state->chk_config_protect) {
freeargv(cp_argc, cp_argv);
@@ -328,9 +327,12 @@ qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv)
fclose(fp_contents_update);
if (renameat(pkg_ctx->fd, "CONTENTS~", pkg_ctx->fd, "CONTENTS"))
unlinkat(pkg_ctx->fd, "CONTENTS~", 0);
- if (!verbose)
+ if (!verbose) {
+ fclose(fp_contents);
return EXIT_SUCCESS;
+ }
}
+ fclose(fp_contents);
if (state->bad_only && num_files_ok != num_files)
printf("%s\n", atom_format(state->fmt, atom));
qcprintf(" %2$s*%1$s %3$s%4$zu%1$s out of %3$s%5$zu%1$s file%6$s are good",