From nobody Fri May 16 03:31:48 2025 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.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498759474405453.80555999486717; Thu, 29 Jun 2017 11:04:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31E60C0C9A62; Thu, 29 Jun 2017 18:04:26 +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 F03358D569; Thu, 29 Jun 2017 18:04:25 +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 1881F3FAE1; Thu, 29 Jun 2017 18:04:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5TI4Fx1006688 for ; Thu, 29 Jun 2017 14:04:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5D14C179DB; Thu, 29 Jun 2017 18:04:15 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB36A17C75 for ; Thu, 29 Jun 2017 18:04:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 31E60C0C9A62 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 31E60C0C9A62 From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 29 Jun 2017 20:03:57 +0200 Message-Id: <1498759443-10136-5-git-send-email-abologna@redhat.com> In-Reply-To: <1498759443-10136-1-git-send-email-abologna@redhat.com> References: <1498759443-10136-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/10] conf: Clean up virDomain{Memory, Shmem}DefParseXML() 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 29 Jun 2017 18:04:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Follow the same style as other similar functions. Signed-off-by: Andrea Bolognani --- src/conf/domain_conf.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ccd3c27..fdb919d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13143,8 +13143,7 @@ virDomainShmemDefParseXML(xmlNodePtr node, unsigned int flags) { char *tmp =3D NULL; - virDomainShmemDefPtr def =3D NULL; - virDomainShmemDefPtr ret =3D NULL; + virDomainShmemDefPtr def; xmlNodePtr msi =3D NULL; xmlNodePtr save =3D ctxt->node; xmlNodePtr server =3D NULL; @@ -13163,7 +13162,7 @@ virDomainShmemDefParseXML(xmlNodePtr node, if ((def->model =3D virDomainShmemModelTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_XML_ERROR, _("Unknown shmem model type '%s'"), tmp); - goto cleanup; + goto error; } =20 VIR_FREE(tmp); @@ -13172,12 +13171,12 @@ virDomainShmemDefParseXML(xmlNodePtr node, if (!(def->name =3D virXMLPropString(node, "name"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("shmem element must contain 'name' attribute")); - goto cleanup; + goto error; } =20 if (virDomainParseScaledValue("./size[1]", NULL, ctxt, &def->size, 1, ULLONG_MAX, false) < 0) - goto cleanup; + goto error; =20 if ((server =3D virXPathNode("./server[1]", ctxt))) { def->server.enabled =3D true; @@ -13197,7 +13196,7 @@ virDomainShmemDefParseXML(xmlNodePtr node, virReportError(VIR_ERR_XML_ERROR, _("invalid number of vectors for shmem: '%s'"), tmp); - goto cleanup; + goto error; } VIR_FREE(tmp); =20 @@ -13208,7 +13207,7 @@ virDomainShmemDefParseXML(xmlNodePtr node, virReportError(VIR_ERR_XML_ERROR, _("invalid msi ioeventfd setting for shmem:= '%s'"), tmp); - goto cleanup; + goto error; } def->msi.ioeventfd =3D val; } @@ -13219,20 +13218,21 @@ virDomainShmemDefParseXML(xmlNodePtr node, if (def->msi.enabled && !def->server.enabled) { virReportError(VIR_ERR_XML_ERROR, "%s", _("msi option is only supported with a server")); - goto cleanup; + goto error; } =20 if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) - goto cleanup; - + goto error; =20 - ret =3D def; - def =3D NULL; cleanup: - ctxt->node =3D save; VIR_FREE(tmp); + ctxt->node =3D save; + return def; + + error: virDomainShmemDefFree(def); - return ret; + def =3D NULL; + goto cleanup; } =20 static int @@ -14394,7 +14394,6 @@ virDomainMemoryDefParseXML(xmlNodePtr memdevNode, =20 def->access =3D val; } - VIR_FREE(tmp); =20 /* source */ if ((node =3D virXPathNode("./source", ctxt)) && @@ -14414,14 +14413,15 @@ virDomainMemoryDefParseXML(xmlNodePtr memdevNode, if (virDomainDeviceInfoParseXML(memdevNode, NULL, &def->info, flags) <= 0) goto error; =20 + cleanup: + VIR_FREE(tmp); ctxt->node =3D save; return def; =20 error: - VIR_FREE(tmp); virDomainMemoryDefFree(def); - ctxt->node =3D save; - return NULL; + def =3D NULL; + goto cleanup; } =20 =20 --=20 2.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list