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 663A015808B 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 826C6E07EE; Sat, 12 Feb 2022 17:13:23 +0000 (UTC) Received: from smtp.gentoo.org (smtp.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 6AE41E07EE for ; Sat, 12 Feb 2022 17:13:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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 ECF22342F6E 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 325802D3 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: <1644683896.48f667375565491d9151ae10137909303cef7685.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qmerge.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 48f667375565491d9151ae10137909303cef7685 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: 64cf0898-81bb-4b6b-a13f-1fa87f4551c0 X-Archives-Hash: 65069e2597035694d415939c027267f9 commit: 48f667375565491d9151ae10137909303cef7685 Author: Fabian Groffen gentoo org> AuthorDate: Sat Feb 12 16:38:16 2022 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sat Feb 12 16:38:16 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=48f66737 qmerge: fix Coverity resource leak (previnst) CID 248877 Signed-off-by: Fabian Groffen gentoo.org> qmerge.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } }