From nobody Fri Apr 26 16:36:50 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599791310; cv=none; d=zohomail.com; s=zohoarc; b=hN9eIkXeJhtFLLlcMYjo+ha5e76SkuL0O4ohQnNQT/DoSHb6GoTJk1NM4KZQSCTGZoLGVNvi/wxPZ2vBrUhJluH5NBI8kVPxeae5YWGYcu+LnsTi6DNFffcei/NpJewcIBlpiq0rwBmDMoLDfYWPjk2IIGeQ4wGcSigHsGOOE+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599791310; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=dxYFoLzCc2daftJshHUJFZGAMIrODPmsAogtVsBnkW4=; b=W0cdUh6cA6faaf5ZSCBfecZbXikdxdMLYoFTb+bMUiYEt0QCtTGm/bm8juwR55vfWbwjflrX3/IvKHT6Vm1pnCdizwaPGRLaCg8gA/SUce1QFv+WpLF41awvjdYn5dUANVl0ry+ijbImAgqy6KT4dDug7BaMHIVmCz4F5gS6CIA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1599791310416309.84512183963693; Thu, 10 Sep 2020 19:28:30 -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-396-jIisDrhnMG2EynKw7TsjJQ-1; Thu, 10 Sep 2020 22:28:24 -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 3A3E22FD02; Fri, 11 Sep 2020 02:28:19 +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 F10405C1D0; Fri, 11 Sep 2020 02:28: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 879C4183D020; Fri, 11 Sep 2020 02:28:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08B2SCh9007389 for ; Thu, 10 Sep 2020 22:28:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4AA412028DCC; Fri, 11 Sep 2020 02:28:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 45C642026F94 for ; Fri, 11 Sep 2020 02:28:09 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 4B854811E76 for ; Fri, 11 Sep 2020 02:28:09 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.204]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-558-A44569AhPV6XTmerXSDtrw-1; Thu, 10 Sep 2020 22:28:06 -0400 Received: from localhost (unknown [192.168.167.70]) by regular1.263xmail.com (Postfix) with ESMTP id A38AE2D7 for ; Fri, 11 Sep 2020 10:25:47 +0800 (CST) Received: from localhost.localdomain (unknown [125.88.171.115]) by smtp.263.net (postfix) whith ESMTP id P24394T139659092330240S1599791124128402_; Fri, 11 Sep 2020 10:25:47 +0800 (CST) X-MC-Unique: jIisDrhnMG2EynKw7TsjJQ-1 X-MC-Unique: A44569AhPV6XTmerXSDtrw-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: X-RL-SENDER: yili@winhong.com X-SENDER: yili@winhong.com X-LOGIN-NAME: yili@winhong.com X-FST-TO: libvir-list@redhat.com X-SENDER-IP: 125.88.171.115 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Yi Li To: libvir-list@redhat.com Subject: [PATCH] tools: Remove unnecessary condition check Date: Fri, 11 Sep 2020 10:24:52 +0800 Message-Id: <20200911022452.3035597-1-yili@winhong.com> 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.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 08B2SCh9007389 X-loop: libvir-list@redhat.com Cc: yilikernel@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.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.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" virshDomainFree correctly handle null pointer parameters. There is no need to check if the parameter is null before calling this function. Signed-off-by: Yi Li Reviewed-by: Erik Skultety --- tools/virsh-domain-monitor.c | 6 ++---- tools/virsh-domain.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 0111116885..4c0da3c695 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1610,10 +1610,8 @@ virshDomainListFree(virshDomainListPtr domlist) size_t i; =20 if (domlist && domlist->domains) { - for (i =3D 0; i < domlist->ndomains; i++) { - if (domlist->domains[i]) - virshDomainFree(domlist->domains[i]); - } + for (i =3D 0; i < domlist->ndomains; i++) + virshDomainFree(domlist->domains[i]); VIR_FREE(domlist->domains); } VIR_FREE(domlist); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index d1d3f8e566..08496cc5bf 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5509,8 +5509,7 @@ doDump(void *opaque) pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL); out_sig: #endif /* !WIN32 */ - if (dom) - virshDomainFree(dom); + virshDomainFree(dom); g_main_loop_quit(data->eventLoop); } =20 --=20 2.25.3