From nobody Tue Feb 10 00:58:54 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=1626189166; cv=none; d=zohomail.com; s=zohoarc; b=HwpP1RhNvsDCs4mq2leGddbHqaPB+hhkjjR/koB7bt8HERI67GWCBPA55rjoQBigocaLhe0SyFEF2EI7k9a5pTlmVcK15bT95IOpnBhkdOSsEsEoONHkq2I4ExvnOQOQPXJ5LmNNfFBXWFbZvXcELuOVDNl89kdFbLJrvfCQ+IM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626189166; 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=CqeeHXB+8ItRmBBy2De3P4DPWZuVPPs4qPW3JZEj1aQ=; b=YGsH1JdYzUw0ng2XnXvPZm2WxRsmTmTAakogphMEHdrGHOPKOZiLBC5ng7jxIimudfBZDGe7LtyiUcCpQfAH+6SDIqrr2wX5rZn/689pFkzE/MguduwMfAAmxwWvVIpq0OYbz3Gi23nRvhCWwcLmkRVzzVQ+Gu0Bg5ranRd3HUU= 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 1626189166662464.754315759663; Tue, 13 Jul 2021 08:12:46 -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-507-HRmdLK4mO-6N_LhDrxw7tQ-1; Tue, 13 Jul 2021 11:12:43 -0400 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 5EA948030D7; Tue, 13 Jul 2021 15:12:36 +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 375C41009962; Tue, 13 Jul 2021 15:12:36 +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 C579B1832ADE; Tue, 13 Jul 2021 15:12:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16DFCRuc003679 for ; Tue, 13 Jul 2021 11:12:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 46D165C22B; Tue, 13 Jul 2021 15:12:27 +0000 (UTC) Received: from work.redhat.com (ovpn-113-139.ams2.redhat.com [10.36.113.139]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9154B5C22A; Tue, 13 Jul 2021 15:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626189165; 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=CqeeHXB+8ItRmBBy2De3P4DPWZuVPPs4qPW3JZEj1aQ=; b=jKwG4cwqTqW89/gExV8k0Z0cHxDEAmWOUa7kJmv2d/qy8mHfaGNnQdwASu8S5zQf8EgCC7 xokqipHY6rfpwlBLsu9btecYZGwMMUE96kEYjDzh0e7eDnxlPPF4YlTobfsxS213iRn20G hsbwl605Jb4K4gr9DjyQgIuXAdbsV4M= X-MC-Unique: HRmdLK4mO-6N_LhDrxw7tQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 08/10] qemuMonitorGetMemoryDeviceInfo: Assign hash table only on success Date: Tue, 13 Jul 2021 17:12:10 +0200 Message-Id: <20210713151212.62582-9-twiederh@redhat.com> In-Reply-To: <20210713151212.62582-1-twiederh@redhat.com> References: <20210713151212.62582-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626189167541100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- src/qemu/qemu_monitor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a2df1a6ec3..9b1a3ec3eb 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4214,6 +4214,7 @@ int qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon, GHashTable **info) { + GHashTable *hash; int ret; =20 VIR_DEBUG("info=3D%p", info); @@ -4222,14 +4223,13 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon, =20 QEMU_CHECK_MONITOR(mon); =20 - if (!(*info =3D virHashNew(g_free))) + if (!(hash =3D virHashNew(g_free))) return -1; =20 - if ((ret =3D qemuMonitorJSONGetMemoryDeviceInfo(mon, *info)) < 0) { - virHashFree(*info); - *info =3D NULL; - } + if ((ret =3D qemuMonitorJSONGetMemoryDeviceInfo(mon, hash)) >=3D 0) + *info =3D g_steal_pointer(&hash); =20 + virHashFree(hash); return ret; } =20 --=20 2.31.1