From nobody Sun Feb 8 22:58:17 2026 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1550687667605233.48948208428828; Wed, 20 Feb 2019 10:34:27 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 906213CBFF; Wed, 20 Feb 2019 18:34:24 +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 5F65E1001E96; Wed, 20 Feb 2019 18:34:24 +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 0FA7E181A010; Wed, 20 Feb 2019 18:34:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1KIY7UC026210 for ; Wed, 20 Feb 2019 13:34:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3DADC1001DE2; Wed, 20 Feb 2019 18:34:07 +0000 (UTC) Received: from libvirt-fedora-29.redhat.com (ovpn-117-20.phx2.redhat.com [10.3.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4AAB1001E8B for ; Wed, 20 Feb 2019 18:34:06 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Wed, 20 Feb 2019 13:34:00 -0500 Message-Id: <20190220183404.31810-3-jferlan@redhat.com> In-Reply-To: <20190220183404.31810-1-jferlan@redhat.com> References: <20190220183404.31810-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/6] conf: Use VIR_AUTOPTR(virBitmap) in domain_conf 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 20 Feb 2019 18:34:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Let's make use of the auto __cleanup capabilities for virBitmapPtr. Signed-off-by: John Ferlan Reviewed-by: Erik Skultety --- src/conf/domain_conf.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 542d53e709..f27af65d80 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1803,8 +1803,8 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, virBitmapPtr autoCpuset) { int maxvcpus =3D virDomainDefGetVcpusMax(def); - virBitmapPtr allcpumap =3D NULL; size_t i; + VIR_AUTOPTR(virBitmap) allcpumap =3D NULL; =20 if (hostcpus < 0) return -1; @@ -1831,7 +1831,6 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, virBitmapToDataBuf(bitmap, VIR_GET_CPUMAP(cpumaps, maplen, i), map= len); } =20 - virBitmapFree(allcpumap); return i; } =20 @@ -2988,7 +2987,7 @@ virDomainIOThreadIDDefArrayInit(virDomainDefPtr def, size_t i; ssize_t nxt =3D -1; virDomainIOThreadIDDefPtr iothrid =3D NULL; - virBitmapPtr thrmap =3D NULL; + VIR_AUTOPTR(virBitmap) thrmap =3D NULL; =20 /* Same value (either 0 or some number), then we have none to fill in = or * the iothreadid array was filled from the XML @@ -3029,7 +3028,6 @@ virDomainIOThreadIDDefArrayInit(virDomainDefPtr def, retval =3D 0; =20 error: - virBitmapFree(thrmap); return retval; } =20 @@ -18327,9 +18325,9 @@ virDomainIOThreadPinDefParseXML(xmlNodePtr node, { int ret =3D -1; virDomainIOThreadIDDefPtr iothrid; - virBitmapPtr cpumask =3D NULL; unsigned int iothreadid; char *tmp =3D NULL; + VIR_AUTOPTR(virBitmap) cpumask =3D NULL; =20 if (!(tmp =3D virXMLPropString(node, "iothread"))) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -18385,7 +18383,6 @@ virDomainIOThreadPinDefParseXML(xmlNodePtr node, =20 cleanup: VIR_FREE(tmp); - virBitmapFree(cpumask); return ret; } =20 @@ -18397,9 +18394,9 @@ virDomainIOThreadPinDefParseXML(xmlNodePtr node, static virBitmapPtr virDomainEmulatorPinDefParseXML(xmlNodePtr node) { - virBitmapPtr def =3D NULL; virBitmapPtr ret =3D NULL; char *tmp =3D NULL; + VIR_AUTOPTR(virBitmap) def =3D NULL; =20 if (!(tmp =3D virXMLPropString(node, "cpuset"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -18419,7 +18416,6 @@ virDomainEmulatorPinDefParseXML(xmlNodePtr node) VIR_STEAL_PTR(ret, def); =20 cleanup: - virBitmapFree(def); VIR_FREE(tmp); return ret; } @@ -18780,11 +18776,11 @@ virDomainThreadSchedParseHelper(xmlNodePtr node, virDomainDefPtr def) { ssize_t next =3D -1; - virBitmapPtr map =3D NULL; virDomainThreadSchedParamPtr sched; virProcessSchedPolicy policy; int priority; int ret =3D -1; + VIR_AUTOPTR(virBitmap) map =3D NULL; =20 if (!(map =3D virDomainSchedulerParse(node, name, &policy, &priority))) goto cleanup; @@ -18807,7 +18803,6 @@ virDomainThreadSchedParseHelper(xmlNodePtr node, ret =3D 0; =20 cleanup: - virBitmapFree(map); return ret; } =20 @@ -19511,12 +19506,12 @@ virDomainCachetuneDefParse(virDomainDefPtr def, { xmlNodePtr oldnode =3D ctxt->node; xmlNodePtr *nodes =3D NULL; - virBitmapPtr vcpus =3D NULL; virResctrlAllocPtr alloc =3D NULL; virDomainResctrlDefPtr resctrl =3D NULL; ssize_t i =3D 0; int n; int ret =3D -1; + VIR_AUTOPTR(virBitmap) vcpus =3D NULL; =20 ctxt->node =3D node; =20 @@ -19576,7 +19571,6 @@ virDomainCachetuneDefParse(virDomainDefPtr def, ctxt->node =3D oldnode; virDomainResctrlDefFree(resctrl); virObjectUnref(alloc); - virBitmapFree(vcpus); VIR_FREE(nodes); return ret; } @@ -19730,9 +19724,9 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, { xmlNodePtr oldnode =3D ctxt->node; xmlNodePtr *nodes =3D NULL; - virBitmapPtr vcpus =3D NULL; virResctrlAllocPtr alloc =3D NULL; virDomainResctrlDefPtr resctrl =3D NULL; + VIR_AUTOPTR(virBitmap) vcpus =3D NULL; =20 ssize_t i =3D 0; int n; @@ -19791,7 +19785,6 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, ctxt->node =3D oldnode; virDomainResctrlDefFree(resctrl); virObjectUnref(alloc); - virBitmapFree(vcpus); VIR_FREE(nodes); return ret; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list