From nobody Mon Feb 9 16:03:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620745409; cv=none; d=zohomail.com; s=zohoarc; b=lIvNVaPvLEYk70zV10tLHohUMwPD1psbkdb2XAZF6cIJJ4kTjBDu1fnrvOZMa0DchKEUAWgTaMG46MM7n1Juzkuc8STOEpZYVZBt0rjbfZ83SRk/YtUtgOqPaUYqV6nX6RsR4Xq3KhVUhvsbqlRoM5yxjGr3QHw+cbEn0+lq82Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620745409; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=seyAFy0DPnDTcF0WF4d/CjMsZtOst1qZDCs9Cd6yrqo=; b=NjSG2apaH5R2yrDe3/L8tpQ8RQBXvbofxd0iNOEZb9VGoVb1uOqUlN0FtbM5Hj4r7wik8vCEUwiJx7Ah42i9VBkI5OwdyzDKr45TYMs8FklncFrYRTzgsiOV5T02WkYkAYT86DheZkc7Zvjegvj8ingbv1ofS6G7qE9fsVE44lQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1620745409781383.34854128407915; Tue, 11 May 2021 08:03:29 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-Qgp3_Bl_MF-6TqRbBoU7Sw-1; Tue, 11 May 2021 11:02:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C6958186F2; Tue, 11 May 2021 15:02:20 +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 5C2673A3; Tue, 11 May 2021 15:02:20 +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 087C95535F; Tue, 11 May 2021 15:02:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14BF22HY005498 for ; Tue, 11 May 2021 11:02:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 08F3560CDE; Tue, 11 May 2021 15:02:02 +0000 (UTC) Received: from work.redhat.com (ovpn-113-41.ams2.redhat.com [10.36.113.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5241A50E2F; Tue, 11 May 2021 15:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620745405; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=seyAFy0DPnDTcF0WF4d/CjMsZtOst1qZDCs9Cd6yrqo=; b=YlfpMty4R6B0yNY+SOENZM3CDynzquJtC/4+bb0DZB9Qn55KiydGSq8g5suwPqSFUouyPd 4D7WCUfoeOu8RpbuHvF8Uj3/nQmLww0FtLpAqK+Q7OXyAPsBxAoWfRX4Q8er6mhQM0+Lnb sqa5ohwdjfrskQUeF00KoReeqjFagck= X-MC-Unique: Qgp3_Bl_MF-6TqRbBoU7Sw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] virDomainNumatuneNodeParseXML: Use g_autofree Date: Tue, 11 May 2021 17:01:50 +0200 Message-Id: <20210511150157.26027-4-twiederh@redhat.com> In-Reply-To: <20210511150157.26027-1-twiederh@redhat.com> References: <20210511150157.26027-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/conf/numa_conf.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index bae59ac7b8..531bdc6eba 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -155,16 +155,15 @@ static int virDomainNumatuneNodeParseXML(virDomainNuma *numa, xmlXPathContextPtr ctxt) { - char *tmp =3D NULL; + g_autofree char *tmp =3D NULL; int n =3D 0; - int ret =3D -1; size_t i =3D 0; - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; =20 if ((n =3D virXPathNodeSet("./numatune/memnode", ctxt, &nodes)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot extract memnode nodes")); - goto cleanup; + return -1; } =20 if (!n) @@ -175,14 +174,14 @@ virDomainNumatuneNodeParseXML(virDomainNuma *numa, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Per-node binding is not compatible with " "automatic NUMA placement.")); - goto cleanup; + return -1; } =20 if (!numa->nmem_nodes) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Element 'memnode' is invalid without " "any guest NUMA cells")); - goto cleanup; + return -1; } =20 for (i =3D 0; i < n; i++) { @@ -192,13 +191,13 @@ virDomainNumatuneNodeParseXML(virDomainNuma *numa, =20 if (virXMLPropUInt(cur_node, "cellid", 10, VIR_XML_PROP_REQUIRED, &cellid) < 0) - goto cleanup; + return -1; =20 if (cellid >=3D numa->nmem_nodes) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Argument 'cellid' in memnode element must " "correspond to existing guest's NUMA cell")); - goto cleanup; + return -1; } =20 mem_node =3D &numa->mem_nodes[cellid]; @@ -207,21 +206,21 @@ virDomainNumatuneNodeParseXML(virDomainNuma *numa, virReportError(VIR_ERR_XML_ERROR, _("Multiple memnode elements with cellid %u"), cellid); - goto cleanup; + return -1; } =20 if (virXMLPropEnumDefault(cur_node, "mode", virDomainNumatuneMemModeTypeFromString, VIR_XML_PROP_NONE, &mem_node->mode, VIR_DOMAIN_NUMATUNE_MEM_STRICT) < 0) - goto cleanup; + return -1; =20 if (numa->memory.mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE && mem_node->mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { virReportError(VIR_ERR_XML_ERROR, "%s", _("'restrictive' mode is required in memnode el= ement " "when mode is 'restrictive' in memory element= ")); - goto cleanup; + return -1; } =20 tmp =3D virXMLPropString(cur_node, "nodeset"); @@ -229,24 +228,20 @@ virDomainNumatuneNodeParseXML(virDomainNuma *numa, virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing required nodeset attribute " "in memnode element")); - goto cleanup; + return -1; } if (virBitmapParse(tmp, &mem_node->nodeset, VIR_DOMAIN_CPUMASK_LEN= ) < 0) - goto cleanup; + return -1; =20 if (virBitmapIsAllClear(mem_node->nodeset)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid value of 'nodeset': %s"), tmp); - goto cleanup; + return -1; } VIR_FREE(tmp); } =20 - ret =3D 0; - cleanup: - VIR_FREE(nodes); - VIR_FREE(tmp); - return ret; + return 0; } =20 int --=20 2.26.3