From nobody Mon Sep 8 17:07:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1752761200680471.66262773292544; Thu, 17 Jul 2025 07:06:40 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id BD6BC12A1; Thu, 17 Jul 2025 10:06:39 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 587781293; Thu, 17 Jul 2025 10:06:22 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 55DCC96D; Thu, 17 Jul 2025 09:55:38 -0400 (EDT) Received: from mail-gw02.astralinux.ru (mail-gw02.astralinux.ru [93.188.205.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 23FE329B for ; Thu, 17 Jul 2025 09:55:37 -0400 (EDT) Received: from gca-msk-a-srv-ksmg01.astralinux.ru (localhost [127.0.0.1]) by mail-gw02.astralinux.ru (Postfix) with ESMTP id 114F91F9E7 for ; Thu, 17 Jul 2025 16:50:23 +0300 (MSK) Received: from new-mail.astralinux.ru (unknown [10.177.185.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail-gw02.astralinux.ru (Postfix) with ESMTPS for ; Thu, 17 Jul 2025 16:50:22 +0300 (MSK) Received: from rbta-spb-lt-115149.astralinux.ru (rbta-msk-lt-190075.astralinux.ru [10.198.59.84]) by new-mail.astralinux.ru (Postfix) with ESMTPA id 4bjZ6m20qmz16Hnq; Thu, 17 Jul 2025 16:49:51 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Greylist: delayed 308 seconds by postgrey-1.37 at lists.libvirt.org; Thu, 17 Jul 2025 09:55:37 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=astralinux.ru; s=mail; t=1752760223; bh=fS1UjiKKApvMpBAORhForXEoRJC9ncvVJHRsZaa7X4A=; h=From:To:Cc:Subject:Date:From; b=y/izLtduK47e8UpX+iCj7PbKjqSvgsvB7iS0y4Q2wQygXRG9ya91PTROnyjmWw9jP A75uHrNTKvl5TxvPDgdMssaqduA4fBG+7niWbcZHvPNA+LE8pHc4mZLOCe6gcGYjYA dOV7ixEcBvo77DlvoSTEdjvGPVK82k07sbJlejJBomwHiIHLBB6GN/7TLDlsV5Tbhi AVlSBuZusw2bd50dpP4yCnVPiLKZ2STaVlj60rEKzZid68F5luFrBWr7XpcYHBotXn VPLHJ4XbWpYijmlrlUGO3T6qN5wqP7/BIVDx9fgXrsIrXH8kcob987faCspTeRzn0G hp+/GLqbUZ4jw== From: Elizaveta Tereshkina To: devel@lists.libvirt.org Subject: [PATCH] network: fix memory leak in networkAddFirewallRules() Date: Thu, 17 Jul 2025 16:49:21 +0300 Message-Id: <20250717134921.107480-1-etereshkina@astralinux.ru> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Envelope-From: etereshkina@astralinux.ru X-KSMG-AntiSpam-Info: LuaCore: 63 0.3.63 9cc2b4b18bf16653fda093d2c494e542ac094a39, {Tracking_uf_ne_domains}, {Tracking_internal2}, {Tracking_from_domain_doesnt_match_to}, 127.0.0.199:7.1.2;new-mail.astralinux.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;astralinux.ru:7.1.1, FromAlignment: s X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiSpam-Lua-Profiles: 194917 [Jul 17 2025] X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Version: 6.1.1.11 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2025/07/17 08:06:00 #27636874 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: NotDetected X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 Content-Transfer-Encoding: quoted-printable X-MailFrom: etereshkina@astralinux.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 Message-ID-Hash: PIPIX6PNDDFPWYVRLTCYTNV6EFBAYALD X-Message-ID-Hash: PIPIX6PNDDFPWYVRLTCYTNV6EFBAYALD X-Mailman-Approved-At: Thu, 17 Jul 2025 14:06:19 -0400 CC: Elizaveta Tereshkina X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1752761204979116600 Content-Type: text/plain; charset="utf-8" Add g_clear_pointer() to networkAddFirewallRules() after using virSetError() to free errInitV4 and errInitV6 to avoid memory leaks. Fixes: ef760a4133 (Revert "network: support setting firewalld zone for brid= ge device of open networks") Signed-off-by: Elizaveta Tereshkina --- src/network/bridge_driver_linux.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/bridge_driver_linux.c b/src/network/bridge_driver_= linux.c index 86f6a5915f..93d4d2c8ee 100644 --- a/src/network/bridge_driver_linux.c +++ b/src/network/bridge_driver_linux.c @@ -413,6 +413,7 @@ networkAddFirewallRules(virNetworkDef *def, (virNetworkDefGetIPByIndex(def, AF_INET, 0) || virNetworkDefGetRouteByIndex(def, AF_INET, 0))) { virSetError(errInitV4); + g_clear_pointer(&errInitV4, virFreeError); return -1; } =20 @@ -421,6 +422,7 @@ networkAddFirewallRules(virNetworkDef *def, virNetworkDefGetRouteByIndex(def, AF_INET6, 0) || def->ipv6nogw)) { virSetError(errInitV6); + g_clear_pointer(&errInitV6, virFreeError); return -1; } =20 --=20 2.39.2