From nobody Sat Feb 7 08:43:58 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com 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 1637245264398865.5112355416277; Thu, 18 Nov 2021 06:21:04 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-112-BNpuKtOOPYyXmWV13No8Cw-1; Thu, 18 Nov 2021 09:20:58 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CEC8B1006AAC; Thu, 18 Nov 2021 14:20:48 +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 AD1F85E26A; Thu, 18 Nov 2021 14:20:48 +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 700694EA2A; Thu, 18 Nov 2021 14:20:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIEKj95013007 for ; Thu, 18 Nov 2021 09:20:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8C1FA404727E; Thu, 18 Nov 2021 14:20:45 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8806B404727D for ; Thu, 18 Nov 2021 14:20:45 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6FD87802802 for ; Thu, 18 Nov 2021 14:20:45 +0000 (UTC) Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-N0NxxqcfOBe-IsE7QnZmGw-1; Thu, 18 Nov 2021 09:20:44 -0500 Received: by mail-ua1-f51.google.com with SMTP id p37so13940785uae.8 for ; Thu, 18 Nov 2021 06:20:44 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id b8sm1734306vsl.19.2021.11.18.06.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:20:41 -0800 (PST) X-MC-Unique: BNpuKtOOPYyXmWV13No8Cw-1 X-MC-Unique: N0NxxqcfOBe-IsE7QnZmGw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iGtHPqdj+RlERq5meqmWN1WMBt+PuAaIxcqih6T8dKs=; b=bDnkldad2xdjDk4VnlMyFJXm4RX4O3veXUJk4ba9Q7thu7QHCyVdnnF/7rUW2Oj/al e0FO9v02yVYMxu92X6l6EPiGPoL/uOcPB4fkHD9IepAwKry4iePeXMyxdVmZ4yfDAdBn wZ020G0Iq//YuRa0UKD4/7hY2iAbjgcLR0XctDq3lIaYhMD6ZT3XyqsmtayJWIkhnJTA DITIWLn/4HWNHtwUj738hG4TrX41CofXWkMu4qKqUjwzP2nKrVcF61//w5nSc89BEiNE lHLoK/VLjEW64TAmP7hfSWrpjNDcgHAOO+Kckiv0Ui/TA9E0LsaFPRnj857juGmFoJ12 8/DA== X-Gm-Message-State: AOAM5327aJRLI6xtdU3RzgegmOJeKJ/wD8kY1715PH3CEj4VGGEXCLDX O+Weevj5DbWu+aYp+6HROEqYgZx2+DOoPg== X-Google-Smtp-Source: ABdhPJz2Qjc4leh7UUgVFc09l34BXca1twKZtqIho82eb11TMCW9wJ8aHxLZcS1gUJ/XAvGzeyDXYQ== X-Received: by 2002:a67:c181:: with SMTP id h1mr81126306vsj.3.1637245241851; Thu, 18 Nov 2021 06:20:41 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 4/7] qemu_capabilities.c: use g_autofree in virQEMUCapsLoadHostCPUModelInfo Date: Thu, 18 Nov 2021 11:20:21 -0300 Message-Id: <20211118142024.275704-5-danielhb413@gmail.com> In-Reply-To: <20211118142024.275704-1-danielhb413@gmail.com> References: <20211118142024.275704-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-loop: libvir-list@redhat.com Cc: danielhb413@gmail.com 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.14 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-ZM-MESSAGEID: 1637245265378100004 Content-Type: text/plain; charset="utf-8" Use 'g_autofree' in the 'str' parameter and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_capabilities.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index aef76ecc56..5257fe64b2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3723,21 +3723,18 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *c= aps, xmlXPathContextPtr ctxt, const char *typeStr) { - char *str =3D NULL; + g_autofree char *str =3D NULL; xmlNodePtr hostCPUNode; g_autofree xmlNodePtr *nodes =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autoptr(qemuMonitorCPUModelInfo) hostCPU =3D NULL; g_autofree char *xpath =3D g_strdup_printf("./hostCPU[@type=3D'%s']", = typeStr); - int ret =3D -1; size_t i; int n; int val; =20 - if (!(hostCPUNode =3D virXPathNode(xpath, ctxt))) { - ret =3D 0; - goto cleanup; - } + if (!(hostCPUNode =3D virXPathNode(xpath, ctxt))) + return 0; =20 hostCPU =3D g_new0(qemuMonitorCPUModelInfo, 1); =20 @@ -3745,14 +3742,14 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *c= aps, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing host CPU model name in QEMU " "capabilities cache")); - goto cleanup; + return -1; } =20 if (!(str =3D virXMLPropString(hostCPUNode, "migratability")) || (val =3D virTristateBoolTypeFromString(str)) <=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("invalid migratability value for host CPU model")= ); - goto cleanup; + return -1; } hostCPU->migratability =3D val =3D=3D VIR_TRISTATE_BOOL_YES; VIR_FREE(str); @@ -3772,7 +3769,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing 'name' attribute for a host CPU" " model property in QEMU capabilities cac= he")); - goto cleanup; + return -1; } =20 if (!(str =3D virXMLPropString(ctxt->node, "type")) || @@ -3780,7 +3777,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing or invalid CPU model property ty= pe " "in QEMU capabilities cache")); - goto cleanup; + return -1; } VIR_FREE(str); =20 @@ -3798,7 +3795,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, _("invalid string value for '%s' host C= PU " "model property in QEMU capabilities = cache"), prop->name); - goto cleanup; + return -1; } break; =20 @@ -3809,7 +3806,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, _("invalid number value for '%s' host C= PU " "model property in QEMU capabilities = cache"), prop->name); - goto cleanup; + return -1; } break; =20 @@ -3823,7 +3820,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, _("unknown migratable value for '%s' ho= st " "CPU model property"), prop->name); - goto cleanup; + return -1; } =20 prop->migratable =3D val; @@ -3833,11 +3830,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *ca= ps, } =20 caps->hostCPU.info =3D g_steal_pointer(&hostCPU); - ret =3D 0; - - cleanup: - VIR_FREE(str); - return ret; + return 0; } =20 =20 --=20 2.31.1