mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user