From nobody Mon Feb 9 17:23:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1626688585; cv=none; d=zohomail.com; s=zohoarc; b=WVQzCzgcMhw9eZ+tO8hMf4e4kD37YEBDxX9F0VIz+Bok5334YEjkZblB6MqdEcJ3KTH3kEAORFdoweESavC6xwTj/e/OV5oORNyG3cFbnoIra1nNqKNWsChUFyWB74Nqhtrwqx99DCdnKUWcJhI3x1Wgxrnp+iaNzmXFHcsC6Ec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626688585; h=Content-Type:Content-Transfer-Encoding:Cc: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=Ewyq/J+aXsp2yaoNC/3+x5s4XSRNEgIGGgfdIyCD//g=; b=KpiKG5RTfV88PSliNpUHoBtv3Rc8RuQZ/VBVOEtiKElaE3y9Ra5v0cEo4tFd1WfQ3o5+xpIeWR5stJjKrEs93N9WiW0iqgFbMAa/N1DC81eaFr0ndUPGrG25HZdQuZ5lc8qTCNiRgEJBRwaLRD20lvDBofVjRGhLkO+qvRygSEk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1626688585701128.92404387224724; Mon, 19 Jul 2021 02:56:25 -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-573-_ntN0PvcMPu2AB3b6IvTPg-1; Mon, 19 Jul 2021 05:56:23 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E4EC81084F54; Mon, 19 Jul 2021 09:56:17 +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 C59245C1C5; Mon, 19 Jul 2021 09:56:17 +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 8D52D4EA3D; Mon, 19 Jul 2021 09:56:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16J9u5vG002608 for ; Mon, 19 Jul 2021 05:56:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id D912810074E1; Mon, 19 Jul 2021 09:56:05 +0000 (UTC) Received: from work.redhat.com (ovpn-113-143.ams2.redhat.com [10.36.113.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F93810016F2; Mon, 19 Jul 2021 09:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626688584; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Ewyq/J+aXsp2yaoNC/3+x5s4XSRNEgIGGgfdIyCD//g=; b=IJWQKLgAKZTSBhekiJpAo4QdHE4tglk86Xy7DwLX/fWQxsKi4gQGt0jy5uBNyI9alTJ3s0 1D5qhc8R1wA8wfDdiyPNtmwZLWD4uEQkqna7gT9JA/HgvoyH6daukXvXmBpNwFRXWQddtg pLFob8caWAvhqEWJ6+DEH9O/PhisJWk= X-MC-Unique: _ntN0PvcMPu2AB3b6IvTPg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] qemuMonitorJSONGetAllBlockJobInfo: Use automatic memory management Date: Mon, 19 Jul 2021 11:55:50 +0200 Message-Id: <20210719095554.26137-7-twiederh@redhat.com> In-Reply-To: <20210719095554.26137-1-twiederh@redhat.com> References: <20210719095554.26137-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.16 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: 1626688585972100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/qemu/qemu_monitor_json.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 472308e1d3..59c5eedb0a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5069,12 +5069,12 @@ GHashTable * qemuMonitorJSONGetAllBlockJobInfo(qemuMonitor *mon, bool rawjobname) { - virJSONValue *cmd =3D NULL; - virJSONValue *reply =3D NULL; + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; virJSONValue *data; size_t nr_results; size_t i; - GHashTable *blockJobs =3D NULL; + g_autoptr(GHashTable) blockJobs =3D NULL; =20 cmd =3D qemuMonitorJSONMakeCommand("query-block-jobs", NULL); if (!cmd) @@ -5103,14 +5103,10 @@ qemuMonitorJSONGetAllBlockJobInfo(qemuMonitor *mon, } =20 cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return blockJobs; + return g_steal_pointer(&blockJobs); =20 error: - virHashFree(blockJobs); - blockJobs =3D NULL; - goto cleanup; + return NULL; } =20 =20 --=20 2.31.1