From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 4DCB615808F for ; Sat, 12 Feb 2022 17:13:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 72EBAE07EF; Sat, 12 Feb 2022 17:13:23 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 544CDE07EE for ; Sat, 12 Feb 2022 17:13:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F179A342F85 for ; Sat, 12 Feb 2022 17:13:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 44AD92D4 for ; Sat, 12 Feb 2022 17:13:20 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1644685118.84f4920ae807927fc0774b5e468797134903554a.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qdepends.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 84f4920ae807927fc0774b5e468797134903554a X-VCS-Branch: master Date: Sat, 12 Feb 2022 17:13:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 691193e5-ffcf-4737-bfd4-63667cbc9a4b X-Archives-Hash: b2d61eedcf0fa96dff65273a11c130fe commit: 84f4920ae807927fc0774b5e468797134903554a Author: Fabian Groffen gentoo org> AuthorDate: Sat Feb 12 16:58:38 2022 +0000 Commit: Fabian Groffen gentoo 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 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 - @@ -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); } }