commit: 84f4920ae807927fc0774b5e468797134903554a Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Sat Feb 12 16:58:38 2022 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Sat Feb 12 16:58:38 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=84f4920a
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 <AT> gentoo.org> qdepends.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/qdepends.c b/qdepends.c index 93b5109..96a791c 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 - <[email protected]> @@ -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); } }
