Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- tools/virsh-domain-monitor.c | 9 +++------ tools/virsh-domain.c | 9 +++------ tools/virsh-interface.c | 3 +-- tools/virsh-network.c | 9 +++------ tools/virsh-nwfilter.c | 6 ++---- tools/virsh-pool.c | 3 +-- tools/virsh-secret.c | 3 +-- tools/virsh-volume.c | 3 +-- tools/virt-admin.c | 6 ++---- 9 files changed, 17 insertions(+), 34 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index fb52915cab..4059acc7d6 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -602,7 +602,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; @@ -686,7 +686,6 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - vshTableFree(table); VIR_FREE(source); VIR_FREE(target); VIR_FREE(device); @@ -723,7 +722,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; @@ -775,7 +774,6 @@ cmdDomiflist(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - vshTableFree(table); VIR_FREE(interfaces); return ret; } @@ -1950,7 +1948,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") || @@ -2072,7 +2070,6 @@ cmdList(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - vshTableFree(table); virshDomainListFree(list); return ret; } diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index fe2bfdaed0..f72ec36f6f 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6983,7 +6983,7 @@ virshVcpuPinQuery(vshControl *ctl, size_t i; int ncpus; bool ret = false; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; if ((ncpus = virshCPUCountCollect(ctl, dom, countFlags, true)) < 0) { if (ncpus == -1) { @@ -7038,7 +7038,6 @@ virshVcpuPinQuery(vshControl *ctl, ret = true; cleanup: - vshTableFree(table); VIR_FREE(cpumap); return ret; } @@ -7604,7 +7603,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) virDomainIOThreadInfoPtr *info = NULL; size_t i; unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; bool ret = false; int rc; @@ -7655,7 +7654,6 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) for (i = 0; i < niothreads; i++) virDomainIOThreadInfoFree(info[i]); VIR_FREE(info); - vshTableFree(table); return ret; } @@ -13907,7 +13905,7 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd) int rc = -1; size_t i, j; virDomainFSInfoPtr *info = NULL; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; size_t ninfos = 0; bool ret = false; @@ -13962,7 +13960,6 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd) virDomainFSInfoFree(info[i]); VIR_FREE(info); } - vshTableFree(table); return ret; } diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 71cc265efc..f88ec188f1 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -348,7 +348,7 @@ cmdInterfaceList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) struct virshInterfaceList *list = NULL; size_t i; bool ret = false; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; VSH_EXCLUSIVE_OPTIONS_VAR(all, inactive); @@ -381,7 +381,6 @@ cmdInterfaceList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) ret = true; cleanup: - vshTableFree(table); virshInterfaceListFree(list); return ret; } diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 152df1086b..d641606dde 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -711,7 +711,7 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) bool optUUID = vshCommandOptBool(cmd, "uuid"); char uuid[VIR_UUID_STRING_BUFLEN]; unsigned int flags = VIR_CONNECT_LIST_NETWORKS_ACTIVE; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; if (vshCommandOptBool(cmd, "inactive")) flags = VIR_CONNECT_LIST_NETWORKS_INACTIVE; @@ -782,7 +782,6 @@ cmdNetworkList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) ret = true; cleanup: - vshTableFree(table); virshNetworkListFree(list); return ret; } @@ -1407,7 +1406,7 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *cmd) size_t i; unsigned int flags = 0; virNetworkPtr network = NULL; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; if (vshCommandOptStringReq(ctl, cmd, "mac", &mac) < 0) return false; @@ -1461,7 +1460,6 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - vshTableFree(table); if (leases) { for (i = 0; i < nleases; i++) virNetworkDHCPLeaseFree(leases[i]); @@ -1754,7 +1752,7 @@ cmdNetworkPortList(vshControl *ctl, const vshCmd *cmd) bool optUUID = vshCommandOptBool(cmd, "uuid"); char uuid[VIR_UUID_STRING_BUFLEN]; unsigned int flags = 0; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; if (optTable + optUUID > 1) { vshError(ctl, "%s", @@ -1795,7 +1793,6 @@ cmdNetworkPortList(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - vshTableFree(table); virshNetworkPortListFree(list); return ret; } diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index 640e54446e..acb35e8aa1 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -354,7 +354,7 @@ cmdNWFilterList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) char uuid[VIR_UUID_STRING_BUFLEN]; bool ret = false; struct virshNWFilterList *list = NULL; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; if (!(list = virshNWFilterListCollect(ctl, 0))) return false; @@ -378,7 +378,6 @@ cmdNWFilterList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) ret = true; cleanup: - vshTableFree(table); virshNWFilterListFree(list); return ret; } @@ -717,7 +716,7 @@ cmdNWFilterBindingList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) size_t i; bool ret = false; struct virshNWFilterBindingList *list = NULL; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; if (!(list = virshNWFilterBindingListCollect(ctl, 0))) return false; @@ -740,7 +739,6 @@ cmdNWFilterBindingList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) ret = true; cleanup: - vshTableFree(table); virshNWFilterBindingListFree(list); return ret; } diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 18f3839a4c..5bce5cf06c 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -1135,7 +1135,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) bool inactive, all; bool uuid = false; bool name = false; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; inactive = vshCommandOptBool(cmd, "inactive"); all = vshCommandOptBool(cmd, "all"); @@ -1390,7 +1390,6 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) ret = true; cleanup: - vshTableFree(table); if (list && list->npools) { for (i = 0; i < list->npools; i++) { VIR_FREE(poolInfoTexts[i].state); diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index cfecbb9b95..4f433fae9c 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -551,7 +551,7 @@ cmdSecretList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) struct virshSecretList *list = NULL; bool ret = false; unsigned int flags = 0; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; if (vshCommandOptBool(cmd, "ephemeral")) flags |= VIR_CONNECT_LIST_SECRETS_EPHEMERAL; @@ -605,7 +605,6 @@ cmdSecretList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) ret = true; cleanup: - vshTableFree(table); virshSecretListFree(list); return ret; } diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 6a1fe6785b..af93998d57 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -1415,7 +1415,7 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) }; struct volInfoText *volInfoTexts = NULL; struct virshStorageVolList *list = NULL; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; /* Look up the pool information given to us by the user */ if (!(pool = virshCommandOptPool(ctl, cmd, "pool", NULL))) @@ -1513,7 +1513,6 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) ret = true; cleanup: - vshTableFree(table); /* Safely free the memory allocated in this function */ if (list && list->nvols) { diff --git a/tools/virt-admin.c b/tools/virt-admin.c index dd17743b9d..c8e7ee794a 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -332,7 +332,7 @@ cmdSrvList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) char *uri = NULL; virAdmServerPtr *srvs = NULL; vshAdmControl *priv = ctl->privData; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; /* Obtain a list of available servers on the daemon */ if ((nsrvs = virAdmConnectListServers(priv->conn, &srvs, 0)) < 0) { @@ -361,7 +361,6 @@ cmdSrvList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) ret = true; cleanup: - vshTableFree(table); if (srvs) { for (i = 0; i < nsrvs; i++) virAdmServerFree(srvs[i]); @@ -580,7 +579,7 @@ cmdSrvClientsList(vshControl *ctl, const vshCmd *cmd) virAdmServerPtr srv = NULL; virAdmClientPtr *clts = NULL; vshAdmControl *priv = ctl->privData; - vshTable *table = NULL; + g_autoptr(vshTable) table = NULL; if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0) return false; @@ -621,7 +620,6 @@ cmdSrvClientsList(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - vshTableFree(table); if (clts) { for (i = 0; i < nclts; i++) virAdmClientFree(clts[i]); -- 2.31.1