tools: virsh-domain: Remove redundant conditional before virshDomainFree

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>
This commit is contained in:
Yi Li 2020-09-11 10:24:52 +08:00 committed by Erik Skultety
parent b4c0fcd5cc
commit b1f10ed031
2 changed files with 3 additions and 6 deletions

View 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);

View 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);
}