diff options
author | Fabian Groffen <grobian@gentoo.org> | 2020-01-02 16:32:37 +0100 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2020-01-02 16:32:37 +0100 |
commit | 7f610741388d8543d3d7652de4625eaa7caa6dfd (patch) | |
tree | 3aadf06ca12dfabcee3e33326632fca24c301600 | |
parent | travis: try differently to get valgrind to run (diff) | |
download | portage-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.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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", |