From nobody Wed Feb 11 04:36:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1681325514; cv=none; d=zohomail.com; s=zohoarc; b=dNJrMClWsUMF4OGaNLwwecSsZSTqHmgLjAYFsWT2URaD+L8964WE5LspSFyuHvdRztXUgFPRv+p9FaK0vt1zrqTV+ukYRvPh99NGMWoUcSoQG3VjKVdQLJg6xn+lcK5veur+IKUulpSgsI4HkbhSPI8BzFHPKV9rcPxuSCWpnho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681325514; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Xa7ooeKNSf+k8dNFDJzvKocJu/52pawuc5iQqeYJl9c=; b=GnKAf5TFgDPG4jwYDe+EWHT7/DJ1Qs1ByYH0tO3uLq+OWKSIyIh9+udnftPmuJBufjg3J59jN63qg7mEIcUpVxn25XBh+kBVqCH+aJX+JSzq39QL9yBKiv9/MgS+DkplQplvxCWG8p10qtESWvKfQtycTDGwDvkjYcVkW7VJy7Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 168132551371664.46070036781055; Wed, 12 Apr 2023 11:51:53 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.520315.807794 (Exim 4.92) (envelope-from ) id 1pmfYy-0002tS-UA; Wed, 12 Apr 2023 18:51:24 +0000 Received: by outflank-mailman (output) from mailman id 520315.807794; Wed, 12 Apr 2023 18:51:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pmfYy-0002tL-RD; Wed, 12 Apr 2023 18:51:24 +0000 Received: by outflank-mailman (input) for mailman id 520315; Wed, 12 Apr 2023 18:51:24 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pmfYx-0001qS-Kg for xen-devel@lists.xenproject.org; Wed, 12 Apr 2023 18:51:24 +0000 Received: from desiato.infradead.org (desiato.infradead.org [2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 045f501b-d963-11ed-b21e-6b7b168915f2; Wed, 12 Apr 2023 20:51:22 +0200 (CEST) Received: from [2001:8b0:10b:1::425] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pmfYf-00E0VL-3D; Wed, 12 Apr 2023 18:51:06 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pmfYe-001r1H-1y; Wed, 12 Apr 2023 19:51:04 +0100 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: 045f501b-d963-11ed-b21e-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=Xa7ooeKNSf+k8dNFDJzvKocJu/52pawuc5iQqeYJl9c=; b=nxQF+PYllY75sHqovcNk2BH4Gi RpVSWDgHzGp6LR/J9XHEZ/8NcMhK+wvi2yYuhn1/gaMykPZ42EuBEZDwbpl+7j+9ffR82KtYbpKHp jDMpMfdHfLyMA6cWiFQ9a+98ywwxU3E4Ks45R78pIEPXpoIkT8fg91nyZVcDyzekRslNMu+N3+Dmi vWtqtkYz9VGIPOJ6qJHf/pF+xK8y0jdGcEwCDtzTR1tSBnHGNjIVmY6iljd5SJMmR7UXzcXXwRDsC ZEJtD3rZKBTKNS1GAyETt1GMxjt9mnIJoRAy5zmBRb9118HdiHPaxBwJA1NYFEIvolFPS+Z3L+hAX p3eq+52w==; From: David Woodhouse To: qemu-devel@nongnu.org Cc: no Stabellini , Anthony Perard , Paul Durrant , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , xen-devel@lists.xenproject.org Subject: [PATCH 2/5] hw/xen: Fix memory leak in libxenstore_open() for Xen Date: Wed, 12 Apr 2023 19:50:59 +0100 Message-Id: <20230412185102.441523-3-dwmw2@infradead.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230412185102.441523-1-dwmw2@infradead.org> References: <20230412185102.441523-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) X-ZM-MESSAGEID: 1681325514529100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse There was a superfluous allocation of the XS handle, leading to it being leaked on both the error path and the success path (where it gets allocated again). Spotted by Coverity (CID 1508098). Fixes: ba2a92db1ff6 ("hw/xen: Add xenstore operations to allow redirection = to internal emulation") Suggested-by: Peter Maydell Signed-off-by: David Woodhouse Reviewed-by: Peter Maydell Reviewed-by: Paul Durrant --- hw/xen/xen-operations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xen/xen-operations.c b/hw/xen/xen-operations.c index 4b78fbf4bd..3d213d28df 100644 --- a/hw/xen/xen-operations.c +++ b/hw/xen/xen-operations.c @@ -287,7 +287,7 @@ static void watch_event(void *opaque) static struct qemu_xs_handle *libxenstore_open(void) { struct xs_handle *xsh =3D xs_open(0); - struct qemu_xs_handle *h =3D g_new0(struct qemu_xs_handle, 1); + struct qemu_xs_handle *h; =20 if (!xsh) { return NULL; --=20 2.39.2