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

[PATCH] tools: Remove unnecessary condition check



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 winhong com>
---
 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





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