From nobody Fri May 3 18:34:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=126.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521282352622959.531986161931; Sat, 17 Mar 2018 03:25:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1237383F45; Sat, 17 Mar 2018 10:25:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DE2F260C8C; Sat, 17 Mar 2018 10:25:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A2CD1181B9FF; Sat, 17 Mar 2018 10:25:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HAP9p3009686 for ; Sat, 17 Mar 2018 06:25:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 877395D755; Sat, 17 Mar 2018 10:25:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 17DE35D70A; Sat, 17 Mar 2018 10:25:03 +0000 (UTC) Received: from m15-114.126.com (m15-114.126.com [220.181.15.114]) by mx1.redhat.com (Postfix) with ESMTP id DF55BC057F81; Sat, 17 Mar 2018 10:25:00 +0000 (UTC) Received: from localhost.localdomain (unknown [58.213.111.46]) by smtp7 (Coremail) with SMTP id DsmowAAXv8Xy7KxaEhREDg--.27012S3; Sat, 17 Mar 2018 18:24:57 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=JnMacNVdibg8AfJg5M 1k855+83aN6FT8M8E+BR4ryGM=; b=eW10wNw+FKbWv7ZAJd3qcSnU6UIkIcYENj wS6qn9eeVVxyQIv18uRTtevxAZiHnwphhD9O06uR1lQ8zKsG4hU//G4R4HvxdOOr 5vX+dCfEp882kfsJKpZnSVHWzQz3C2YQq+RTFtAAfWtDxg+xL2hHO2FYASoy8TP4 8nh8Rb3AQ= From: Chen Hanxiao To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 18:24:08 +0800 Message-Id: <20180317102409.20265-2-chen_han_xiao@126.com> In-Reply-To: <20180317102409.20265-1-chen_han_xiao@126.com> References: <20180317102409.20265-1-chen_han_xiao@126.com> X-CM-TRANSID: DsmowAAXv8Xy7KxaEhREDg--.27012S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7CFWrGr48tr4fuF18KrW8Crg_yoW8XFW7pF 98Gw1q9w45Jwn5C3s8WF4Fy3W5Grs7Ar1xGrn3Ww1jy3W0gF17Jr1IkryjqF4UK3yakr1f urn7Kw17tr4093DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jzmhrUUUUU= X-Originating-IP: [58.213.111.46] X-CM-SenderInfo: xfkh0spkdqs5xldrqiyswou0bp/1tbiFhoMrlpD5B8-HQAAsu X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 17 Mar 2018 10:25:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 17 Mar 2018 10:25:02 +0000 (UTC) for IP:'220.181.15.114' DOMAIN:'m15-114.126.com' HELO:'m15-114.126.com' FROM:'chen_han_xiao@126.com' RCPT:'' X-RedHat-Spam-Score: 1.99 * (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_PSBL, SPF_PASS, T_RP_MATCHES_RCVD) 220.181.15.114 m15-114.126.com 220.181.15.114 m15-114.126.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Chen Hanxiao Subject: [libvirt] [PATCH 1/2] virarptable: fix some leaks and format issue X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 17 Mar 2018 10:25:51 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Chen Hanxiao fix some leaks and format issue Also support virArpTableFree to get NULL. Signed-off-by: Chen Hanxiao --- src/util/virarptable.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/util/virarptable.c b/src/util/virarptable.c index 92839fdca..c0e90dc4b 100644 --- a/src/util/virarptable.c +++ b/src/util/virarptable.c @@ -47,6 +47,7 @@ VIR_LOG_INIT("util.arptable"); # define NDA_RTA(r) \ ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg)))) =20 + static int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) { @@ -64,7 +65,9 @@ parse_rtattr(struct rtattr *tb[], int max, struct rtattr = *rta, int len) return 0; } =20 -virArpTablePtr virArpTableGet(void) + +virArpTablePtr +virArpTableGet(void) { int num =3D 0; int msglen; @@ -156,6 +159,7 @@ virArpTablePtr virArpTableGet(void) return table; =20 cleanup: + virArpTableFree(table); VIR_FREE(ipstr); VIR_FREE(nlData); return NULL; @@ -163,7 +167,8 @@ virArpTablePtr virArpTableGet(void) =20 #else =20 -virArpTablePtr virArpTableGet(void) +virArpTablePtr +virArpTableGet(void) { virReportError(VIR_ERR_NO_SUPPORT, "%s", _("get arp table not implemented on this platform")); @@ -176,6 +181,10 @@ void virArpTableFree(virArpTablePtr table) { size_t i; + + if (!table) + return; + for (i =3D 0; i < table->n; i++) { VIR_FREE(table->t[i].ipaddr); VIR_FREE(table->t[i].mac); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 18:34:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=126.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521282355651991.9222490081571; Sat, 17 Mar 2018 03:25:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7321A7FEC2; Sat, 17 Mar 2018 10:25:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 46E555D70A; Sat, 17 Mar 2018 10:25:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 04D364CA9A; Sat, 17 Mar 2018 10:25:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HAP9fh009685 for ; Sat, 17 Mar 2018 06:25:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 85FE45D75C; Sat, 17 Mar 2018 10:25:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D6AB5D755; Sat, 17 Mar 2018 10:25:04 +0000 (UTC) Received: from m15-114.126.com (m15-114.126.com [220.181.15.114]) by mx1.redhat.com (Postfix) with ESMTP id E06034E05D; Sat, 17 Mar 2018 10:25:00 +0000 (UTC) Received: from localhost.localdomain (unknown [58.213.111.46]) by smtp7 (Coremail) with SMTP id DsmowAAXv8Xy7KxaEhREDg--.27012S4; Sat, 17 Mar 2018 18:24:57 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=agbSiy+oIOiu+631wW SPp4DqCqxM3QQ2QCUiDK3Dv7A=; b=BQ3u8C4Mlnd9nxCC4+Vu9eoua68ctTBgRK pa8T42N3khzm3mo27m4JyQbpSk55QW8l0pAkJfGRgEjYYSoxjtwObLm3dIH09Sy+ GU1NRtqKI7xkE+u5AHBjpILphSjcdzd/Va1NE0ehLhT86LdYEdrQL7+ZL4C6EbFe 63Gdh8NIM= From: Chen Hanxiao To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 18:24:09 +0800 Message-Id: <20180317102409.20265-3-chen_han_xiao@126.com> In-Reply-To: <20180317102409.20265-1-chen_han_xiao@126.com> References: <20180317102409.20265-1-chen_han_xiao@126.com> X-CM-TRANSID: DsmowAAXv8Xy7KxaEhREDg--.27012S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrurWDur4UArW3tw4kZFW3GFg_yoW3Xwc_Cr yUCws7GrZ5Cryjka4Y9FnxArnYvwn5Xwn5Cwsayrs8K34j9FyrtF9FqFs3Kr1DJayfZFyx Xw1rtFnY934vqjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU0DfH5UUUUU== X-Originating-IP: [58.213.111.46] X-CM-SenderInfo: xfkh0spkdqs5xldrqiyswou0bp/1tbiaRoMrlpD4avysQAAsB X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Mar 2018 10:25:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Mar 2018 10:25:03 +0000 (UTC) for IP:'220.181.15.114' DOMAIN:'m15-114.126.com' HELO:'m15-114.126.com' FROM:'chen_han_xiao@126.com' RCPT:'' X-RedHat-Spam-Score: 1.99 * (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_PSBL, SPF_PASS, T_RP_MATCHES_RCVD) 220.181.15.114 m15-114.126.com 220.181.15.114 m15-114.126.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Chen Hanxiao Subject: [libvirt] [PATCH 2/2] qemu: fix a mem leak X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 17 Mar 2018 10:25:54 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Chen Hanxiao fix a mem leak Signed-off-by: Chen Hanxiao --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5c55c69af..14b72a8f6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20682,6 +20682,8 @@ qemuARPGetInterfaces(virDomainObjPtr vm, =20 if (VIR_APPEND_ELEMENT(ifaces_ret, ifaces_count, iface) < = 0) goto cleanup; + + virDomainInterfaceFree(iface); } } } @@ -20691,6 +20693,7 @@ qemuARPGetInterfaces(virDomainObjPtr vm, =20 cleanup: virArpTableFree(table); + virDomainInterfaceFree(iface); =20 if (ifaces_ret) { for (i =3D 0; i < ifaces_count; i++) --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list