diff options
author | Fabian Groffen <grobian@gentoo.org> | 2022-02-12 17:38:16 +0100 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2022-02-12 17:38:16 +0100 |
commit | 48f667375565491d9151ae10137909303cef7685 (patch) | |
tree | fbdcdc97abe26d01668e0f289928abafc90f2d3a | |
parent | qtbz2: attempt to fix Coverity taint warning (diff) | |
download | portage-utils-48f667375565491d9151ae10137909303cef7685.tar.gz portage-utils-48f667375565491d9151ae10137909303cef7685.tar.bz2 portage-utils-48f667375565491d9151ae10137909303cef7685.zip |
qmerge: fix Coverity resource leak (previnst) CID 248877
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r-- | qmerge.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1089,8 +1089,10 @@ pkg_merge(int level, const depend_atom *qatom, const tree_match_ctx *mpkg) /* Get a handle on the main vdb repo */ vdb = tree_open_vdb(portroot, portvdb); if (vdb == NULL) { - if (pretend) + if (pretend) { + tree_match_close(previnst); return; + } /* try to create a vdb if none exists yet */ xasprintf(&p, "%s/%s", portroot, portvdb); mkdir_p(p, 0755); @@ -1103,12 +1105,14 @@ pkg_merge(int level, const depend_atom *qatom, const tree_match_ctx *mpkg) if (!cat_ctx) { if (errno != ENOENT) { tree_close(vdb); + tree_match_close(previnst); return; } mkdirat(vdb->tree_fd, mpkg->atom->CATEGORY, 0755); cat_ctx = tree_open_cat(vdb, mpkg->atom->CATEGORY); if (!cat_ctx) { tree_close(vdb); + tree_match_close(previnst); return; } } |