From nobody Sun Feb 8 17:03:48 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1644346399; cv=none; d=zohomail.com; s=zohoarc; b=WT9eODaQyfUu/J9QY8bOa28nPk0/pfM9nzpmHM1nIzfAZKtBMakMEZcY4LQRUPSmCBIxq7CKVKjyr2r+PTNAcAcGZA8h0oQgzjUAMZF2cV7fWpsjJcOb5P2sBvsLouwaVBFRoCzharPHEL/fldXCO0Ndr9NrOPiyoeiNGRbvILY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644346399; 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=yUYQJshHnIyTn43QuBaJuxTFmVBmcBe0asw122z/cVs=; b=cP4hWYT2ElITv3fTUqgEdC7QNxITLbCSiVUs7RxvsOgkY+AN5fn0H1oNq9fF3j5nfUh8caU7AUoX7Ed01JdFjUv7nXA096uc1zeE6/137uZdAIlGzKwv/XZnm2+W797WBkgoohPtnmoBO0LD8Yx7/9b/7mjiGQ9HkJ3+j8EiSAg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1644346399027712.6767877316993; Tue, 8 Feb 2022 10:53:19 -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-231-XiB5PFzQNBGl5W873I3Ovw-1; Tue, 08 Feb 2022 13:53:14 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81FD38519F8; Tue, 8 Feb 2022 18:53:08 +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 5F45834D41; Tue, 8 Feb 2022 18:53:08 +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 3118D4A70D; Tue, 8 Feb 2022 18:53:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 217BseZ6032455 for ; Mon, 7 Feb 2022 06:54:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id D0F5C6FB88; Mon, 7 Feb 2022 11:54:40 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34C086FB8B for ; Mon, 7 Feb 2022 11:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644346398; 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=yUYQJshHnIyTn43QuBaJuxTFmVBmcBe0asw122z/cVs=; b=TvcloheexCcnb8Xa/2O1Azcht+SpeHRsuiNQcvNJyLcdR0ltEvXKdkX69hTR9HwJN/QpPo RbSEetD1XFoWLFSGrb45DWxQ0giivrO6EvLL7lZFSkA4ZFPiE2nBUVXvC13tXnTDi5/5zX 9kkpNUzn5b1DfIY5L4t8LC5oGwAbuKE= X-MC-Unique: XiB5PFzQNBGl5W873I3Ovw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/7] qemuProcessUpdateAndVerifyCPU: Refactor cleanup Date: Mon, 7 Feb 2022 12:53:54 +0100 Message-Id: <1675a3c3af302c6afdd92aeeffdce3116ce59eb3.1644234805.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.23 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644346400824100001 Content-Type: text/plain; charset="utf-8" Use automatic memory clearing and remove the 'ret' variable. Signed-off-by: Peter Krempa --- src/qemu/qemu_process.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ea586e54c1..d080ab1c49 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4335,25 +4335,19 @@ qemuProcessUpdateAndVerifyCPU(virQEMUDriver *driver, virDomainObj *vm, qemuDomainAsyncJob asyncJob) { - virCPUData *cpu =3D NULL; - virCPUData *disabled =3D NULL; - int ret =3D -1; + g_autoptr(virCPUData) cpu =3D NULL; + g_autoptr(virCPUData) disabled =3D NULL; if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < = 0) - goto cleanup; + return -1; if (qemuProcessVerifyCPU(vm, cpu) < 0) - goto cleanup; + return -1; if (qemuProcessUpdateLiveGuestCPU(vm, cpu, disabled) < 0) - goto cleanup; - - ret =3D 0; + return -1; - cleanup: - virCPUDataFree(cpu); - virCPUDataFree(disabled); - return ret; + return 0; } --=20 2.34.1