From nobody Mon Feb 9 00:07:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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=1585316689; cv=none; d=zohomail.com; s=zohoarc; b=LYBGCaLj3sp/t3vQkFIo4SE13rmlO2PDa1FgzpAMQZcyo1sIVrZPLMG31YNJDvlOhQsLBRBdSgSuw1TwGVz049sS5YU44LbPThQgSHRe8MHH3dl7YjA50x5ZF9zrwjdWMXp7nuBDNSlz5mfErRPYDLCf5C5gymGassRrBvsFcqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316689; h=Content-Type:Content-Transfer-Encoding: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=yrPByb0fu39jCGmrSLslIhsAdgV5U++3Hr46VIZj/Hg=; b=jKk/ECabjHvzsh47lX5S5nMp9hN4yMDcsldHBUOXMHE7NNPB0r7f0AcskyBQexUtvC2A4Guf52Oz8PIdFY7UOSvilV8nDOlYCJXZ1YIcgnHhwyv55G5ND7ngWb9u2C1ynUVHpR7CyFZkItBUTpGkBPp0b9QG3RChaQyX759iyW8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 158531668943739.02930704772359; Fri, 27 Mar 2020 06:44:49 -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-154-ZrM7p7o5N3OWUwUoRMqwcA-1; Fri, 27 Mar 2020 09:44:44 -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 5C6EC1B18BC1; Fri, 27 Mar 2020 13:44:39 +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 360B096FA5; Fri, 27 Mar 2020 13:44:39 +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 E16041808855; Fri, 27 Mar 2020 13:44:38 +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 02RDiKgC006297 for ; Fri, 27 Mar 2020 09:44:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id BFAB160BF4; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8FE7C60BF3 for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id DB33918D192; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316687; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=yrPByb0fu39jCGmrSLslIhsAdgV5U++3Hr46VIZj/Hg=; b=N2Lr5m+3UZ8/5ruqONIHz0nA0sza/pOeUnvTQsr3ws9wb7J4ICXtkpfbQn7nn3VvBmbNSu OXvGUZ0evO5NrqShGTg56DE3E0i2kd3ZT/lUwf0MuYwGCM71fidGG1lque5cfIhUMdluVX NKzX+lTipHbzqBgSWMLKxBH1ON0vbF4= X-MC-Unique: ZrM7p7o5N3OWUwUoRMqwcA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 10/39] cpu_x86: Use g_auto* in x86FeatureParse Date: Fri, 27 Mar 2020 14:43:39 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.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.13 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: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index a678bcde61..d2bbcbd891 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1023,13 +1023,12 @@ x86FeatureParse(xmlXPathContextPtr ctxt, void *data) { virCPUx86MapPtr map =3D data; - xmlNodePtr *nodes =3D NULL; - virCPUx86FeaturePtr feature; + g_autofree xmlNodePtr *nodes =3D NULL; + g_autoptr(virCPUx86Feature) feature =3D NULL; virCPUx86DataItem item; size_t i; int n; - char *str =3D NULL; - int ret =3D -1; + g_autofree char *str =3D NULL; =20 feature =3D g_new0(virCPUx86Feature, 1); feature->migratable =3D true; @@ -1038,7 +1037,7 @@ x86FeatureParse(xmlXPathContextPtr ctxt, if (x86FeatureFind(map, feature->name)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("CPU feature %s already defined"), feature->name); - goto cleanup; + return -1; } =20 str =3D virXPathString("string(@migratable)", ctxt); @@ -1047,13 +1046,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt, =20 n =3D virXPathNodeSet("./cpuid|./msr", ctxt, &nodes); if (n < 0) - goto cleanup; + return -1; =20 if (n =3D=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing cpuid or msr element in feature %s"), feature->name); - goto cleanup; + return -1; } =20 for (i =3D 0; i < n; i++) { @@ -1063,37 +1062,31 @@ x86FeatureParse(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid cpuid[%zu] in %s feature"), i, feature->name); - goto cleanup; + return -1; } } else { if (x86ParseMSR(ctxt, &item) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid msr[%zu] in %s feature"), i, feature->name); - goto cleanup; + return -1; } } =20 if (virCPUx86DataAddItem(&feature->data, &item)) - goto cleanup; + return -1; } =20 if (!feature->migratable && VIR_APPEND_ELEMENT_COPY(map->migrate_blockers, map->nblockers, feature) < 0) - goto cleanup; + return -1; =20 if (VIR_APPEND_ELEMENT(map->features, map->nfeatures, feature) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - x86FeatureFree(feature); - VIR_FREE(nodes); - VIR_FREE(str); - return ret; + return 0; } =20 =20 --=20 2.26.0