From nobody Sun Feb 8 21:12:14 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=1585316702; cv=none; d=zohomail.com; s=zohoarc; b=bD7es/yp42IKLl2+NjLNp4MNfoRsd5HW4JLiaX2d8Nwi9N4bacVRhOT3b0kxXqx6HbqyPl8qSE0uivopp8Xwp8Txvq/p3x4SWdTauTeo+A+ACbUKFdknqr55qttMAC5WNGJpn/KfBN2h6FamxVpxoN3D5AFTOwZyHazgIcQPOww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316702; 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=dxIRbniAtP+QxonVJrdnsWlOoj2fb5Trj8iIjCybkAM=; b=GnUtRkVoiRGIx4eMjlgQfeWvbMezoiMB+UZ0Sv0Q124w5oOMNan44AHHTXN7T3pG995N7S/0EDPjmhfofVW2WwfMLZNYdgV/NnpZtFpNTsXv8xVwYkLTYdItFx1yObfLdc6KVN7eXPWPM+tGPtLrYz9ACOduJsKIuBfxMSoeH2w= 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 1585316702527739.1758918777771; Fri, 27 Mar 2020 06:45:02 -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-34-g_kUwgDGMN6P9QZfvP_IAA-1; Fri, 27 Mar 2020 09:44:58 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 853768017CC; Fri, 27 Mar 2020 13:44:50 +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 580C960C87; Fri, 27 Mar 2020 13:44:50 +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 06E9718034EA; Fri, 27 Mar 2020 13:44:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiOex006415 for ; Fri, 27 Mar 2020 09:44:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 851CE5C1D8; 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 579CA5C219 for ; Fri, 27 Mar 2020 13:44:23 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 0D91718D5B2; 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=1585316701; 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=dxIRbniAtP+QxonVJrdnsWlOoj2fb5Trj8iIjCybkAM=; b=AhDdQZZwRNs6Vntpbq3WQeoeLyXnXxxJbiFLu1U4wL+gldcb7NgIEOCfY1QxP/wn0ulCr+ MHS7LJRSXlcpsvYILhVsiRH3u4kssH927UnnS5X9hEFnv6fIRV2XSrvjaMRRGEXSfvjHW5 HRl69FvzBNotwTGDGOQlPKoz/ztgDhk= X-MC-Unique: g_kUwgDGMN6P9QZfvP_IAA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 23/39] cpu_x86: Use g_auto* in x86UpdateHostModel Date: Fri, 27 Mar 2020 14:43:52 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.12 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 | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ccbae3dabd..9f6027ec5c 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2821,17 +2821,16 @@ static int x86UpdateHostModel(virCPUDefPtr guest, const virCPUDef *host) { - virCPUDefPtr updated =3D NULL; + g_autoptr(virCPUDef) updated =3D NULL; size_t i; - int ret =3D -1; =20 if (!(updated =3D virCPUDefCopyWithoutModel(host))) - goto cleanup; + return -1; =20 updated->type =3D VIR_CPU_TYPE_GUEST; updated->mode =3D VIR_CPU_MODE_CUSTOM; if (virCPUDefCopyModel(updated, host, true) < 0) - goto cleanup; + return -1; =20 if (guest->vendor_id) { VIR_FREE(updated->vendor_id); @@ -2842,18 +2841,15 @@ x86UpdateHostModel(virCPUDefPtr guest, if (virCPUDefUpdateFeature(updated, guest->features[i].name, guest->features[i].policy) < 0) - goto cleanup; + return -1; } =20 virCPUDefStealModel(guest, updated, guest->mode =3D=3D VIR_CPU_MODE_CUSTOM); guest->mode =3D VIR_CPU_MODE_CUSTOM; guest->match =3D VIR_CPU_MATCH_EXACT; - ret =3D 0; =20 - cleanup: - virCPUDefFree(updated); - return ret; + return 0; } =20 =20 --=20 2.26.0