[PATCH] tools: Remove unnecessary condition check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <yili@xxxxxxxxxxx>
---
 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;
 
     if (domlist && domlist->domains) {
-        for (i = 0; i < domlist->ndomains; i++) {
-            if (domlist->domains[i])
-                virshDomainFree(domlist->domains[i]);
-        }
+        for (i = 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);
 }
 
-- 
2.25.3







[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux