From nobody Mon Feb 9 03:14:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1609941866; cv=none; d=zohomail.com; s=zohoarc; b=QHOuXMt6CoFG4XEt1flDtIw1W3hNRZaTAEcWLibwBdJi8oYij7lkJ+B92/mK94LC3fXIRTf0A0vDBE5KAJzEHviA9JhJke6rvkAJJQz1cbqOML4QJL7H52f+W+ahvvZuR3cjOST1zZ3pkSR8ZFwNk6TR6LvmS4AItvoTlTeRFwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941866; 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=xg0e3wC+zinCDIPEP9gtiVGEy148edL3BusunFPDw7I=; b=n/KdUY18SQJPxtHm1Q7lIihS2Q9+D1RvB+cqLuW4dfSaGMV2iLanZUhE+f8MMCcIgoM0uFFHNO6difndZhbDPJA0k3sksgTIcGW8r8W//CIpTeibQp3CQfa9WY3gdPN3vjw7tsgIIvsFC9J6QS3x4hJCPvTOLaYXgauyzW24cQM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1609941866746897.6529874787428; Wed, 6 Jan 2021 06:04:26 -0800 (PST) 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-262-VO3JXwTIM0aYP7c3ilfRrg-1; Wed, 06 Jan 2021 09:04:22 -0500 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 67686EC1A3; Wed, 6 Jan 2021 14:04:15 +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 42C7C5C1C4; Wed, 6 Jan 2021 14:04:15 +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 F2B1B1809CA9; Wed, 6 Jan 2021 14:04:14 +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 106E3vfb031394 for ; Wed, 6 Jan 2021 09:03:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 49E6037A0; Wed, 6 Jan 2021 14:03:57 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B9FA6267A for ; Wed, 6 Jan 2021 14:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941865; 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=xg0e3wC+zinCDIPEP9gtiVGEy148edL3BusunFPDw7I=; b=AO5t4v3O29ig684V+SUoLhQneJ725RHEwVVV+qtTUuAzgNv5trF2B6MCG0oTWMEYYFeGFw eUz3Es8LQo6KQ5ZjYJNTd09Sn2t7sShxxVlo/yRUll0MZzH1hmvy7ifPk6nhlmEjBDh+jF cVHJcs+BcdQHv1i7rsgr31vQuNlAuvE= X-MC-Unique: VO3JXwTIM0aYP7c3ilfRrg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/12] qemuMonitorAddObject: Fix semantics of @alias Date: Wed, 6 Jan 2021 15:03:38 +0100 Message-Id: <8d3207ca31888dbb4a31a60d0b97ee9216b8f754.1609941694.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.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) Content-Type: text/plain; charset="utf-8" The callers of qemuMonitorAddObject rely on the fact that @alias is filled only when the object is added successfully. This is documented but the code didn't behave like that. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a55c4e19dd..7919eb3a04 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3076,11 +3076,14 @@ qemuMonitorAddObject(qemuMonitorPtr mon, if (alias) tmp =3D g_strdup(id); - ret =3D qemuMonitorJSONAddObject(mon, props); + if (qemuMonitorJSONAddObject(mon, props) < 0) + goto cleanup; if (alias) *alias =3D g_steal_pointer(&tmp); + ret =3D 0; + cleanup: VIR_FREE(tmp); virJSONValueFree(*props); --=20 2.29.2