]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tools: virsh-domain: Remove redundant conditional before virshDomainFree
authorYi Li <yili@winhong.com>
Fri, 11 Sep 2020 02:24:52 +0000 (10:24 +0800)
committerErik Skultety <eskultet@redhat.com>
Fri, 11 Sep 2020 08:12:09 +0000 (10:12 +0200)
virshDomainFree handles NULL pointers gracefully, so there's no need to
check the pointer before the call.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
tools/virsh-domain-monitor.c
tools/virsh-domain.c

index 0111116885ac183b7dfc9f62bcafbb406270e746..4c0da3c695d2358396772b467df421b45cc3c124 100644 (file)
@@ -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);
index d1d3f8e566d394746dc7ba1cb95bafb74013d574..08496cc5bfdf0313e8a7c676237ed874a2864bfb 100644 (file)
@@ -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);
 }