From nobody Sun Feb 8 12:37:35 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 1637244164947153.52433964766408; Thu, 18 Nov 2021 06:02:44 -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-204-2x9diWS9MSaQ5gblAKZF0Q-1; Thu, 18 Nov 2021 09:02:39 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 194C919253CF; Thu, 18 Nov 2021 14:02:32 +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 C9D4710016F2; Thu, 18 Nov 2021 14:02:31 +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 76E4E4EA3C; Thu, 18 Nov 2021 14:02:31 +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 1AIE0Cx6010943 for ; Thu, 18 Nov 2021 09:00:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9319C404727E; Thu, 18 Nov 2021 14:00:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8ED084047279 for ; Thu, 18 Nov 2021 14:00:12 +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 7827385A5BD for ; Thu, 18 Nov 2021 14:00:12 +0000 (UTC) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-248-0YhKd1nrNI2zeylORRrYeQ-1; Thu, 18 Nov 2021 09:00:10 -0500 Received: by mail-qt1-f179.google.com with SMTP id a2so6039670qtx.11 for ; Thu, 18 Nov 2021 06:00:10 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id e7sm1542168qtx.72.2021.11.18.06.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:00:09 -0800 (PST) X-MC-Unique: 2x9diWS9MSaQ5gblAKZF0Q-1 X-MC-Unique: 0YhKd1nrNI2zeylORRrYeQ-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=oMKa8qMuADuWs+gVWDsEmXsyUDxW+jcRWLNElI3jSW1q6RymDX+gWL4/LnNcnCk1l3 5SHjaH3p1oQ7Xqeq/aFDkDIixwAbqr5pLYHctMSt5ZclzxBFzv3Q4vLVmSrTjHpewvIS 6htyry2YwJdpYsTyGV/wfekABezyl+rTvWWiF5G0OUrWKTERf8D7iRwWfQYYkzp7p/gt IJkrzBeNKfqzX9Ccp1cPaBUgAQOoLJ9N+wZSm3JTb/ObqEKQqJQYkF6tdux+4pfeIsCg hn03VieMqGl463h3ufwpp3Iao0/MH1hsEbuscqSMJXyaY/Udaqojkp4hLCKYuQAQ8hNX Kl0w== X-Gm-Message-State: AOAM533c25N03YQ5lHmiyeQ9yHjAL8BdUkOHndYYXQ+KF5zrvbClxuSL CWNlpKTYgyrJawfzDf2UekuI8axnFPcPdg== X-Google-Smtp-Source: ABdhPJx6oIIgd564SgAyskoxWruz3UWQqe0jZTyZqa73Q0lUXAg0QfiqMpWQmd+NMzi22NDZta5ETw== X-Received: by 2002:ac8:5a8e:: with SMTP id c14mr26584500qtc.332.1637244009262; Thu, 18 Nov 2021 06:00:09 -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 10:59:44 -0300 Message-Id: <20211118135944.272979-8-danielhb413@gmail.com> In-Reply-To: <20211118135944.272979-1-danielhb413@gmail.com> References: <20211118135944.272979-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: danielh413@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.84 on 10.5.11.22 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: 1637244209486100005 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