From nobody Tue Feb 10 12:57:26 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=1619535966; cv=none; d=zohomail.com; s=zohoarc; b=Ho2RxF+hyhbOP4KDa8P1mfNlFa4hfqxj1ApyY3ocSZkAiWIZ8zEmFrM9XHCkmyhHO+93ayBkB5Y7v18BIVywxMIH08Wml0JEhxLyb8tzZQFS6xnuHoWlmbebop9a2tTT+GqXJvxp7C39BPD4q4YVRW4ZpnggQaFv41VLYDXYcdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619535966; 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=NGKv/z0ZkzMksyDCKIwJAjFe+vSJWQJ5fI7iLCtyAQY=; b=aEtR6/cnOoMe4VOfbLpxhSjrrSMZ5CEFLj1Yx2Ev3q6TnKDRmFUCu5WDwvALKpr+yvraAJ7BiYtmm9Vv4EkH+/A0xie6PrqJnFaYqQhW8A/wClFJ1F72/sxKYRC80zzvR2BACXprzVNDE3LgFNY8gaAoWuJIdqiNfVUt7oDcTzM= 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 1619535966343991.2847199481206; Tue, 27 Apr 2021 08:06:06 -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-44-LLHO3pi9N8ObPzjc3vTHew-1; Tue, 27 Apr 2021 11:05:23 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FA38804030; Tue, 27 Apr 2021 15:05:16 +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 1225E6A035; Tue, 27 Apr 2021 15:05:16 +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 CB7881806D20; Tue, 27 Apr 2021 15:05:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13RF5DcZ032033 for ; Tue, 27 Apr 2021 11:05:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id C09CC61093; Tue, 27 Apr 2021 15:05:13 +0000 (UTC) Received: from work.redhat.com (ovpn-113-91.ams2.redhat.com [10.36.113.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C07C61008; Tue, 27 Apr 2021 15:05:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619535963; 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=NGKv/z0ZkzMksyDCKIwJAjFe+vSJWQJ5fI7iLCtyAQY=; b=Bpa3p1DfBvEFllFRbULO8Xdg1mPdORK6FOJx/jFiqm+7Cn9QP4/gujHWIttZ+yji3toFFE 44Kk/Rbyj+9w/Fqidj3xWrBpzCP8sGVhAwZ5XTBn5E3vZIIIP8/N1GxuYTJI96LtRqRue1 kj0po7WQC+MAqQacq4mSWXmYD+jCMck= X-MC-Unique: LLHO3pi9N8ObPzjc3vTHew-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] virDomainShmemDef: Use g_auto* Date: Tue, 27 Apr 2021 17:04:40 +0200 Message-Id: <20210427150441.206606-10-twiederh@redhat.com> In-Reply-To: <20210427150441.206606-1-twiederh@redhat.com> References: <20210427150441.206606-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.79 on 10.5.11.13 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 Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a6547cad8e..2f7878da2b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13982,15 +13982,11 @@ virDomainShmemDefParseXML(virDomainXMLOption *xml= opt, xmlXPathContextPtr ctxt, unsigned int flags) { - virDomainShmemDef *def =3D NULL; - virDomainShmemDef *ret =3D NULL; - xmlNodePtr msi =3D NULL; - VIR_XPATH_NODE_AUTORESTORE(ctxt) - xmlNodePtr server =3D NULL; + g_autoptr(virDomainShmemDef) def =3D g_new0(virDomainShmemDef, 1); xmlNodePtr model; - g_autofree char *tmp =3D NULL; - - def =3D g_new0(virDomainShmemDef, 1); + xmlNodePtr msi; + xmlNodePtr server; + VIR_XPATH_NODE_AUTORESTORE(ctxt) =20 ctxt->node =3D node; =20 @@ -14000,33 +13996,33 @@ virDomainShmemDefParseXML(virDomainXMLOption *xml= opt, * compatibility reasons. */ if (virXMLPropEnum(model, "type", virDomainShmemModelTypeFromStrin= g, VIR_XML_PROP_NONE, &def->model) < 0) - goto cleanup; + return NULL; } =20 if (!(def->name =3D virXMLPropString(node, "name"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("shmem element must contain 'name' attribute")); - goto cleanup; + return NULL; } =20 if (def->model !=3D VIR_DOMAIN_SHMEM_MODEL_IVSHMEM) { if (virXMLPropEnum(node, "role", virDomainShmemRoleTypeFromString, VIR_XML_PROP_NONZERO, &def->role) < 0) - goto cleanup; + return NULL; } =20 if (virParseScaledValue("./size[1]", NULL, ctxt, &def->size, 1, ULLONG_MAX, false) < 0) - goto cleanup; + return NULL; =20 if ((server =3D virXPathNode("./server[1]", ctxt))) { - def->server.enabled =3D true; + g_autofree char *tmp =3D NULL; =20 + def->server.enabled =3D true; def->server.chr.type =3D VIR_DOMAIN_CHR_TYPE_UNIX; def->server.chr.data.nix.listen =3D false; if ((tmp =3D virXMLPropString(server, "path"))) def->server.chr.data.nix.path =3D virFileSanitizePath(tmp); - VIR_FREE(tmp); } =20 if ((msi =3D virXPathNode("./msi[1]", ctxt))) { @@ -14034,28 +14030,25 @@ virDomainShmemDefParseXML(virDomainXMLOption *xml= opt, =20 if (virXMLPropUInt(msi, "vectors", 0, VIR_XML_PROP_NONE, &def->msi.vectors) < 0) - goto cleanup; + return NULL; =20 if (virXMLPropTristateSwitch(msi, "ioeventfd", VIR_XML_PROP_NONE, &def->msi.ioeventfd) < 0) - goto cleanup; + return NULL; } =20 /* msi option is only relevant with a server */ if (def->msi.enabled && !def->server.enabled) { virReportError(VIR_ERR_XML_ERROR, "%s", _("msi option is only supported with a server")); - goto cleanup; + return NULL; } =20 if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info, flags)= < 0) - goto cleanup; + return NULL; =20 =20 - ret =3D g_steal_pointer(&def); - cleanup: - virDomainShmemDefFree(def); - return ret; + return g_steal_pointer(&def); } =20 static int --=20 2.26.3