aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2022-02-12 17:38:16 +0100
committerFabian Groffen <grobian@gentoo.org>2022-02-12 17:38:16 +0100
commit48f667375565491d9151ae10137909303cef7685 (patch)
treefbdcdc97abe26d01668e0f289928abafc90f2d3a
parentqtbz2: attempt to fix Coverity taint warning (diff)
downloadportage-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.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/qmerge.c b/qmerge.c
index 501011a..c41b095 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -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;
}
}