From nobody Sun Feb 8 05:08:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1635159483; cv=none; d=zohomail.com; s=zohoarc; b=J+nJi5gY90sRSb9oUwM/FMlgACzWb/30k3jL8aPu2lAaQRhxS4xoIws6D0zKMdkZHT/gZjdJ/HuhBfYWDDzgBrDHmw6AXENnS3OVNWAKYqEMVsoRN+aIX9mAArjg1LxDRWHkP28R5/lRE03cLsoc3k+4W2Ez7yZd4m0zr6FQ59c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635159483; 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=spYOI+SX84CSE9nYjA2Imq6C7V1osizHwOIM/QuR+VA=; b=hsjL+R+DCd/qdUw3JXrwhZkKQ07pdUDWFl9OosDdfT5PiUDYWW0vC6lBM1Dszt9HiPrHsqBs61ghLHwBQ2AbwZCGA1MQ62b3c0nuOkaSaTmlqL1NYODm0sIDu1NNZKR9P5SW/IDKG/n0XqxyXk4+1RCnHxUHm3JDzKqgvqk+Ldk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1635159483964880.5592797914607; Mon, 25 Oct 2021 03:58:03 -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-6-pxEQ-pf1PZ2LWHQ33j015w-1; Mon, 25 Oct 2021 06:57:59 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2FA139F952; Mon, 25 Oct 2021 10:57:54 +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 0F1D45DD68; Mon, 25 Oct 2021 10:57:54 +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 C57FD181A1D0; Mon, 25 Oct 2021 10:57:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19PAvpfI016853 for ; Mon, 25 Oct 2021 06:57:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3834CADCD; Mon, 25 Oct 2021 10:57:51 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3B055DAA5 for ; Mon, 25 Oct 2021 10:57:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635159483; 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=spYOI+SX84CSE9nYjA2Imq6C7V1osizHwOIM/QuR+VA=; b=Gb2sxndnE3bckhzRwaErMAyXzMx2Bi5WoyfePCrLL1j9W9H5ddmDE7N8CszfAoTA09M7TU zIRZJoCpdKnbRoMqLXyZ+9jbPZezHKeqIqdZTolkLlkIZYfO4GJlen9LOlPjF/YDlfn0mG r11XsMQ22nenrGtxvZJv38XMcaFzejs= X-MC-Unique: pxEQ-pf1PZ2LWHQ33j015w-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 03/13] qemuMonitorJSONHumanCommand: Require @reply_str Date: Mon, 25 Oct 2021 12:57:27 +0200 Message-Id: <14d62f1b60d5cb770cd5c940fe657c71daba4b89.1635159386.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.14 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: 1635159485374100005 Content-Type: text/plain; charset="utf-8" All callers of qemuMonitorJSONHumanCommand() pass a non-NULL pointer as @reply_str therefore there's no need to check whether it is NULL. NB, the sister function (qemuMonitorJSONArbitraryCommand()) doesn't check for NULL either. Signed-off-by: Michal Privoznik --- src/qemu/qemu_monitor_json.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 6d8ccd91e8..7833038a06 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1470,6 +1470,7 @@ qemuMonitorJSONHumanCommand(qemuMonitor *mon, virJSONValue *cmd =3D NULL; virJSONValue *reply =3D NULL; virJSONValue *obj; + const char *data; int ret =3D -1; =20 cmd =3D qemuMonitorJSONMakeCommand("human-monitor-command", @@ -1490,13 +1491,8 @@ qemuMonitorJSONHumanCommand(qemuMonitor *mon, goto cleanup; =20 obj =3D virJSONValueObjectGet(reply, "return"); - - if (reply_str) { - const char *data; - - data =3D virJSONValueGetString(obj); - *reply_str =3D g_strdup(NULLSTR_EMPTY(data)); - } + data =3D virJSONValueGetString(obj); + *reply_str =3D g_strdup(NULLSTR_EMPTY(data)); =20 ret =3D 0; =20 --=20 2.32.0