From nobody Mon Feb 9 06:26:56 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=1638282843; cv=none; d=zohomail.com; s=zohoarc; b=nveb+muedYSFyWlGL7Fapf+wLRXCpMpYZ1cIrp0EbJFDpaRNyO86BkWIJIt/0G7SjnP4qoSL36iaZjQXTS0Y4Y+TR1tazu2W8OieodOPBGiXi1P8WV9c8rL4ApUXCHkopaBc+/hj1oUIM2NutesgJFWJ6kGF/utUqqMsLOcf9b4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282843; 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=XXQNZCFd05/vnJ39uAa/9oG/Fbq8Qn8Zg0RfaMj1QgM=; b=fUQzFwHtJ1hyX783NPtf3JzjvtHC3IHEpIZ8xz3RMNNaS1f1+099wCK/tCSm9dNPEUPpX/SRPdUb+ky5hSrHCmIJUaYqDyq7ngPivD5xhhJMkvvkWZtxLUxM9SXH9YJkV78KTZfidkRVukiK72G6UZlG43nJy2OioFVWmHbvzL0= 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 1638282843244212.48364732261507; Tue, 30 Nov 2021 06:34:03 -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-248-AcsZVrI0NJKLytvzY0_8hg-1; Tue, 30 Nov 2021 09:33:25 -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 5547C81CCBD; Tue, 30 Nov 2021 14:33:14 +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 2415E196FF; Tue, 30 Nov 2021 14:33:14 +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 E240C1802E24; Tue, 30 Nov 2021 14:33:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXA16022790 for ; Tue, 30 Nov 2021 09:33:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id B945660C13; Tue, 30 Nov 2021 14:33:10 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22F1860C81 for ; Tue, 30 Nov 2021 14:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282842; 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=XXQNZCFd05/vnJ39uAa/9oG/Fbq8Qn8Zg0RfaMj1QgM=; b=TlQsKLHflOIKJ0kDYiJnZUge4dyNhlHC1nhO4PokY+BUeNrY48ARUdVlAw69xDKxUu+IIH W+ZbI9kDn9jxrIHjbK+b2YXk9yGm6cn6yd+sYRh86O4uGptIihvtTzDDcYj+h0L9tPLhNo /Yw7+jkhRPJUfSZbxlYi2xZuu9yCEYU= X-MC-Unique: AcsZVrI0NJKLytvzY0_8hg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/23] qemuRefreshVirtioChannelState: Automatically free GHashTable and refactor cleanup Date: Tue, 30 Nov 2021 15:31:54 +0100 Message-Id: <66dcf50a2d868dc15c0130495072e902bd4a94a8.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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: 1638282845282100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_process.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c355a39e15..8dface7ec0 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2245,25 +2245,19 @@ qemuRefreshVirtioChannelState(virQEMUDriver *driver, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv =3D vm->privateData; - GHashTable *info =3D NULL; - int ret =3D -1; + g_autoptr(GHashTable) info =3D NULL; + int rc; if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; - - ret =3D qemuMonitorGetChardevInfo(priv->mon, &info); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret =3D -1; + return -1; - if (ret < 0) - goto cleanup; + rc =3D qemuMonitorGetChardevInfo(priv->mon, &info); + if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + return -1; qemuProcessRefreshChannelVirtioState(driver, vm, info, false); - ret =3D 0; - cleanup: - virHashFree(info); - return ret; + return 0; } --=20 2.31.1