tools: virsh: use automatic cleanup for vshTable

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Ján Tomko
2021-08-11 15:12:02 +02:00
parent 5f7cdb0efc
commit 4b72960b4e
9 changed files with 17 additions and 34 deletions

View File

@@ -590,7 +590,7 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd)
char *device = NULL;
char *target = NULL;
char *source = NULL;
vshTable *table = NULL;
g_autoptr(vshTable) table = NULL;
if (vshCommandOptBool(cmd, "inactive"))
flags |= VIR_DOMAIN_XML_INACTIVE;
@@ -674,7 +674,6 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd)
ret = true;
cleanup:
vshTableFree(table);
VIR_FREE(source);
VIR_FREE(target);
VIR_FREE(device);
@@ -711,7 +710,7 @@ cmdDomiflist(vshControl *ctl, const vshCmd *cmd)
int ninterfaces;
xmlNodePtr *interfaces = NULL;
size_t i;
vshTable *table = NULL;
g_autoptr(vshTable) table = NULL;
if (vshCommandOptBool(cmd, "inactive"))
flags |= VIR_DOMAIN_XML_INACTIVE;
@@ -763,7 +762,6 @@ cmdDomiflist(vshControl *ctl, const vshCmd *cmd)
ret = true;
cleanup:
vshTableFree(table);
VIR_FREE(interfaces);
return ret;
}
@@ -1938,7 +1936,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd)
char id_buf[VIR_INT64_STR_BUFLEN];
unsigned int id;
unsigned int flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE;
vshTable *table = NULL;
g_autoptr(vshTable) table = NULL;
/* construct filter flags */
if (vshCommandOptBool(cmd, "inactive") ||
@@ -2060,7 +2058,6 @@ cmdList(vshControl *ctl, const vshCmd *cmd)
ret = true;
cleanup:
vshTableFree(table);
virshDomainListFree(list);
return ret;
}