We were forgetting to release the memory allocated by
virDomainSnapshotListNames. Free the memory properly.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
tools/virsh.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 93a9f45..04b47a1 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -8345,7 +8345,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
int ret = FALSE;
int numsnaps;
char **names = NULL;
- int actual;
+ int actual = 0;
int i;
xmlDocPtr xml = NULL;
xmlXPathContextPtr ctxt = NULL;
@@ -8432,6 +8432,8 @@ cleanup:
if (xml)
xmlFreeDoc(xml);
VIR_FREE(doc);
+ for (i = 0; i < actual; i++)
+ VIR_FREE(names[i]);
VIR_FREE(names);
if (dom)
virDomainFree(dom);
--
1.6.6.1