From nobody Thu May 2 11:25:45 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1603272271; cv=none; d=zohomail.com; s=zohoarc; b=CcuQIzw7DDQ1yyZjXxLcKbFotItIziv2mMVj/05sateYjndGspESfhyUVOwbEfbC2RFnzGGYlLYkR4HBtkkzpZLcaz5njOjhyQjrslNTnteRMESrOULhv+Q8dfxEoVQ8XQPRSXGrEQbjf5kOEDHlIYz3XcPNSmERCK2tWl/+NMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603272271; 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=ZWs29MY2dRUdnXA6Lbun31VPS2j5EPwGbm/+bJEhevE=; b=ngx6IZ2I9Tq4vfjrmOZQZNBGNZiOhcJvMgvZyZCZcAjASZ+B6eb3KpRzlf6M/lVNb0vuWSxx/5oIlFVRZ4jQN/4RVsKeZHifT5hX0BmHc/0fd6FXa5exwYY/hZRPSqqsLDPzRy9Om/hUaEsTxfuur4PlAXSDc8MVj/Sijs4DNdI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com 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 1603272271760638.7581152304193; Wed, 21 Oct 2020 02:24:31 -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-377-c2-90tqrNOGqbsPINkGR7A-1; Wed, 21 Oct 2020 05:24:28 -0400 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 039D0640AA; Wed, 21 Oct 2020 09:24:21 +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 7580227C2A; Wed, 21 Oct 2020 09:24:20 +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 CDC38181A06B; Wed, 21 Oct 2020 09:24:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09L9Nt5H014657 for ; Wed, 21 Oct 2020 05:23:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E00F2156A39; Wed, 21 Oct 2020 09:23:55 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 15B7B2156A3C for ; Wed, 21 Oct 2020 09:23:52 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED074800296 for ; Wed, 21 Oct 2020 09:23:51 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.196]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-507-s_vSwmGpM0-wqzHimz1mpw-1; Wed, 21 Oct 2020 05:23:48 -0400 Received: from localhost (unknown [192.168.167.16]) by regular1.263xmail.com (Postfix) with ESMTP id 3492118CB for ; Wed, 21 Oct 2020 17:23:45 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.70]) by smtp.263.net (postfix) whith ESMTP id P30223T139798469658368S1603272222134780_; Wed, 21 Oct 2020 17:23:46 +0800 (CST) X-MC-Unique: c2-90tqrNOGqbsPINkGR7A-1 X-MC-Unique: s_vSwmGpM0-wqzHimz1mpw-1 X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-IP-DOMAINF: 1 X-UNIQUE-TAG: <9c6e2747b510f1d18c848268601fe741> X-RL-SENDER: yili@winhong.com X-SENDER: yili@winhong.com X-LOGIN-NAME: yili@winhong.com X-FST-TO: pkrempa@redhat.com X-SENDER-IP: 14.18.236.70 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Yi Li To: pkrempa@redhat.com, libvir-list@redhat.com Subject: [PATCH v3] qemuMonitorJSONCheckReply: Use g_autofree Date: Wed, 21 Oct 2020 17:23:40 +0800 Message-Id: <20201021092340.3236836-1-yili@winhong.com> In-Reply-To: <20201019085003.GE3081357@angien.pipo.sk> References: <20201019085003.GE3081357@angien.pipo.sk> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 09L9Nt5H014657 X-loop: libvir-list@redhat.com Cc: danielhb413@gmail.com, yili@winhong.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 Content-Type: text/plain; charset="utf-8" Eliminate cleanup code by using g_autofree. Signed-off-by: Yi Li Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_monitor_json.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 6c763ecc12..4994ace071 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -455,8 +455,8 @@ qemuMonitorJSONCheckReply(virJSONValuePtr cmd, =20 data =3D virJSONValueObjectGet(reply, "return"); if (virJSONValueGetType(data) !=3D type) { - char *cmdstr =3D virJSONValueToString(cmd, false); - char *retstr =3D virJSONValueToString(data, false); + g_autofree char *cmdstr =3D virJSONValueToString(cmd, false); + g_autofree char *retstr =3D virJSONValueToString(data, false); =20 VIR_DEBUG("Unexpected return type %d (expecting %d) for command %s= : %s", virJSONValueGetType(data), type, cmdstr, retstr); @@ -464,8 +464,6 @@ qemuMonitorJSONCheckReply(virJSONValuePtr cmd, _("unexpected type returned by QEMU command '%s'"), qemuMonitorJSONCommandName(cmd)); =20 - VIR_FREE(cmdstr); - VIR_FREE(retstr); return -1; } =20 --=20 2.25.3