virAdmConnectGetURI() returns string that needs to be free()'d but we
haven't done that very much.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
tools/virt-admin.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index c47053639dd0..bc9ae9366280 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -69,9 +69,6 @@ vshAdmCatchDisconnect(virAdmConnectPtr conn ATTRIBUTE_UNUSED,
virErrorPtr error;
char *uri = NULL;
- if (reason == VIR_CONNECT_CLOSE_REASON_CLIENT)
- return;
-
error = virSaveLastError();
uri = virAdmConnectGetURI(conn);
@@ -98,6 +95,8 @@ vshAdmCatchDisconnect(virAdmConnectPtr conn ATTRIBUTE_UNUSED,
virSetError(error);
virFreeError(error);
}
+
+ VIR_FREE(uri);
}
static int
@@ -323,7 +322,7 @@ cmdSrvList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
int nsrvs = 0;
size_t i;
bool ret = false;
- const char *uri = NULL;
+ char *uri = NULL;
virAdmServerPtr *srvs = NULL;
vshAdmControlPtr priv = ctl->privData;
@@ -347,6 +346,7 @@ cmdSrvList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
virAdmServerFree(srvs[i]);
VIR_FREE(srvs);
}
+ VIR_FREE(uri);
return ret;
}
--
2.7.2