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.129.124 as permitted sender) client-ip=170.10.129.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.129.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.129.124]) by mx.zohomail.com with SMTPS id 1637245267032723.4366568645407; Thu, 18 Nov 2021 06:21:07 -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-117-xvN6_iM7OwWeJJAaHIEylA-1; Thu, 18 Nov 2021 09:21:02 -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 155D5100B3AF; Thu, 18 Nov 2021 14:20:54 +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 E3C465E26A; Thu, 18 Nov 2021 14:20:53 +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 AC38A4EA2A; Thu, 18 Nov 2021 14:20:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIEKqkm013044 for ; Thu, 18 Nov 2021 09:20:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 252F951DD; Thu, 18 Nov 2021 14:20:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F25051DC for ; Thu, 18 Nov 2021 14:20:49 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 37C77811E84 for ; Thu, 18 Nov 2021 14:20:49 +0000 (UTC) Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-88-E9jDKE15NCuS45OgDQxBeQ-1; Thu, 18 Nov 2021 09:20:47 -0500 Received: by mail-ua1-f54.google.com with SMTP id o1so14017945uap.4 for ; Thu, 18 Nov 2021 06:20:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:20:47 -0800 (PST) X-MC-Unique: xvN6_iM7OwWeJJAaHIEylA-1 X-MC-Unique: E9jDKE15NCuS45OgDQxBeQ-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=0SWwMv3itC9hqOJzfgS9rFvBfPcN7YpP/MFJxbNZzts=; b=p+7TbZwot2YqX4e7bOpS5wFy10KqEthmcKc7owIU5hM6KsVHPz7o75Ei59OgMSOt1M Yipl6z6u6UCYUxUj+8Crl+LrLrMXhB6eWQ9bDWs/OTWwyt0sUUpAIz3pgTOrqnMqhkEz 9XasITrh/B23FbFQY57ok/JJLf0x/Fq/2rSEzVwrsVr+PETeEiGFUtHXsPsgAo7m933j 0B7wDQuFXZ6OvchR5sC7HAKwotXa3sXQzjyYSsg7Xg4Pfhvt/aMVyXOmb/cBzf11/Jxh mIjgiz+01yUeUOPV13MsQgmK9byZVC9L56HVBFOrZPnfWBKEJsEVWekEfsL/Ka05EEP6 nQBw== X-Gm-Message-State: AOAM532A3ADsMEFAW0o6cFNhCUYXBux3nx05o5VrlzjHcYIqwcMx62Pj dZDX3EL6Ua7bgtNrpN52dW0h5lqulOM/5g== X-Google-Smtp-Source: ABdhPJwHTLoshjHDeuaIkkAFeK/ul2ye85Y1YwOl5HDAWW/EBisyFZRUoatKIdqms3CJr/SaibWvMQ== X-Received: by 2002:a05:6102:72a:: with SMTP id u10mr83054951vsg.9.1637245247289; Thu, 18 Nov 2021 06:20:47 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 7/7] qemu_capabilities.c: use g_autoptr() in virQEMUCapsInitHostCPUModel() Date: Thu, 18 Nov 2021 11:20:24 -0300 Message-Id: <20211118142024.275704-8-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.79 on 10.11.54.5 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: 1637245268821100001 Content-Type: text/plain; charset="utf-8" All 'virCPUDef' pointers can be auto-freed and the 'cleanup' label removed. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_capabilities.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5257fe64b2..dbf08d681b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3597,11 +3597,11 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, virArch hostArch, virDomainVirtType type) { - virCPUDef *cpu =3D NULL; - virCPUDef *cpuExpanded =3D NULL; - virCPUDef *migCPU =3D NULL; - virCPUDef *hostCPU =3D NULL; - virCPUDef *fullCPU =3D NULL; + g_autoptr(virCPUDef) cpu =3D NULL; + g_autoptr(virCPUDef) cpuExpanded =3D NULL; + g_autoptr(virCPUDef) migCPU =3D NULL; + g_autoptr(virCPUDef) hostCPU =3D NULL; + g_autoptr(virCPUDef) fullCPU =3D NULL; size_t i; int rc; =20 @@ -3676,19 +3676,14 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, goto error; } =20 - virQEMUCapsSetHostModel(qemuCaps, type, cpu, migCPU, fullCPU); + virQEMUCapsSetHostModel(qemuCaps, type, g_steal_pointer(&cpu), + g_steal_pointer(&migCPU), + g_steal_pointer(&fullCPU)); =20 - cleanup: - virCPUDefFree(cpuExpanded); - virCPUDefFree(hostCPU); return; =20 error: - virCPUDefFree(cpu); - virCPUDefFree(migCPU); - virCPUDefFree(fullCPU); virResetLastError(); - goto cleanup; } =20 =20 --=20 2.31.1