aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2022-02-12 17:58:38 +0100
committerFabian Groffen <grobian@gentoo.org>2022-02-12 17:58:38 +0100
commit84f4920ae807927fc0774b5e468797134903554a (patch)
tree68d8b8e8e01b848bb3fd88ab0dc138117d3f98c1
parentqmerge: fix Coverity resource leak (previnst) CID 248877 (diff)
downloadportage-utils-84f4920ae807927fc0774b5e468797134903554a.tar.gz
portage-utils-84f4920ae807927fc0774b5e468797134903554a.tar.bz2
portage-utils-84f4920ae807927fc0774b5e468797134903554a.zip
qdepends: resolve Coverity resource leak CID 248875
This is actually a false positive, because state->udeps at this point can and will never be NULL, so there's no new resource returned that is leaked. However, since it is code-wise cleaner to assign the result, do so. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--qdepends.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/qdepends.c b/qdepends.c
index 93b51095..96a791c8 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2021 Gentoo Authors
+ * Copyright 2005-2022 Gentoo Authors
* Distributed under the terms of the GNU General Public License v2
*
* Copyright 2005-2010 Ned Ludd - <solar@gentoo.org>
@@ -256,15 +256,17 @@ qdepends_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
snprintf(buf, sizeof(buf), "%s%s%s",
RED, atom_to_string(atom), NORM);
if (quiet < 2)
- add_set_unique(buf, state->udeps, NULL);
+ state->udeps = add_set_unique(buf,
+ state->udeps, NULL);
} else if (!quiet) {
- add_set_unique(atom_to_string(atom),
- state->udeps, NULL);
+ state->udeps = add_set_unique(atom_to_string(atom),
+ state->udeps, NULL);
}
}
} else {
array_for_each(state->deps, m, atom)
- add_set_unique(atom_to_string(atom), state->udeps, NULL);
+ state->udeps = add_set_unique(atom_to_string(atom),
+ state->udeps, NULL);
}
}