From nobody Sun Feb 8 08:27:42 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=1585316800; cv=none; d=zohomail.com; s=zohoarc; b=fLNAa6XjYFJZVcHU9IBzbwWr+pHT8iBlXtTiyLsGrH1qk6v5n1h2GvyByNo6TXHE9jzISvzOwwF4v2jn9zJGWDq0d47B0HbJqJloOk8LGuYTZ1dn+/U3jc6WwV7gMnawGGO2QyGQtzhQTb4CVPnqSox/u510OnqTmPBc3+W6o4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316800; 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=6nj42ZU2aI7S2LfyYRA8/uC6t+yNeHpt4ojaO5rwnoo=; b=EzGdxrhO7p7Z1eQBRQOHr0QlJNfmzF9oD+2v4b55f1GtkZNvHPoo+WPFbOybGqbq6bZQDBJFTRUG20TDMABYFWZwXAZkr1PvgtUSIEEL1/opAA4IdzrRk9GspXnLJ3tpbm8Juy+73NRg0NPjBZAYeRp//P74Lg8K5CL9piz7ido= 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 1585316800399772.0129919295205; Fri, 27 Mar 2020 06:46:40 -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-494-2YcpHVRsO2q77_Z2O4schw-1; Fri, 27 Mar 2020 09:45:43 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id F0904107B7D7; Fri, 27 Mar 2020 13:45:37 +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 C3710CDBE1; Fri, 27 Mar 2020 13:45:37 +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 69EDD944CB; Fri, 27 Mar 2020 13:45:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiOXS006424 for ; Fri, 27 Mar 2020 09:44:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id DA864CDBE9; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A994ECDBE8 for ; Fri, 27 Mar 2020 13:44:24 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 18FC018F8B8; Fri, 27 Mar 2020 14:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316799; 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=6nj42ZU2aI7S2LfyYRA8/uC6t+yNeHpt4ojaO5rwnoo=; b=NMek8gMmm9ube4ensJt5cbqP44cOQ81frq715yylLMMGdBV+LAm+Rv+Qnw69v6zdQlF0xs jQmAOJLQYW+MLL3EGyePKTcUjArBvQfP7qtKe+pWO1RhSyo7HGM5W+bM6s3YJkIMAWN7zo Qvk9j2TUzFqIGYQmpxx2k1AKFsXSSSs= X-MC-Unique: 2YcpHVRsO2q77_Z2O4schw-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 27/39] cpu_x86: Use g_auto* in virCPUx86ExpandFeatures Date: Fri, 27 Mar 2020 14:43:56 +0100 Message-Id: <7ecdf220f3ee3f2bfb7889af8a67bb36787e7fe6.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.11 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 | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 3f6d889722..a65215caed 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3059,30 +3059,29 @@ static int virCPUx86ExpandFeatures(virCPUDefPtr cpu) { virCPUx86MapPtr map; - virCPUDefPtr expanded =3D NULL; - virCPUx86ModelPtr model =3D NULL; + g_autoptr(virCPUDef) expanded =3D NULL; + g_autoptr(virCPUx86Model) model =3D NULL; bool host =3D cpu->type =3D=3D VIR_CPU_TYPE_HOST; size_t i; - int ret =3D -1; =20 if (!(map =3D virCPUx86GetMap())) - goto cleanup; + return -1; =20 if (!(expanded =3D virCPUDefCopy(cpu))) - goto cleanup; + return -1; =20 virCPUDefFreeFeatures(expanded); =20 if (!(model =3D x86ModelFind(map, cpu->model))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown CPU model %s"), cpu->model); - goto cleanup; + return -1; } =20 if (!(model =3D x86ModelCopy(model)) || x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE, &model->data, map) < 0) - goto cleanup; + return -1; =20 for (i =3D 0; i < cpu->nfeatures; i++) { virCPUFeatureDefPtr f =3D cpu->features + i; @@ -3093,17 +3092,12 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu) continue; =20 if (virCPUDefUpdateFeature(expanded, f->name, f->policy) < 0) - goto cleanup; + return -1; } =20 virCPUDefFreeModel(cpu); =20 - ret =3D virCPUDefCopyModel(cpu, expanded, false); - - cleanup: - virCPUDefFree(expanded); - x86ModelFree(model); - return ret; + return virCPUDefCopyModel(cpu, expanded, false); } =20 =20 --=20 2.26.0