提交 52ae076a 编写于 作者: C Chris Lalancette

Fix memory leak in virsh snapshot-list.

We were forgetting to release the memory allocated by
virDomainSnapshotListNames.  Free the memory properly.
Signed-off-by: NChris Lalancette <clalance@redhat.com>
上级 21c6cfc2
...@@ -8360,7 +8360,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) ...@@ -8360,7 +8360,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
int ret = FALSE; int ret = FALSE;
int numsnaps; int numsnaps;
char **names = NULL; char **names = NULL;
int actual; int actual = 0;
int i; int i;
xmlDocPtr xml = NULL; xmlDocPtr xml = NULL;
xmlXPathContextPtr ctxt = NULL; xmlXPathContextPtr ctxt = NULL;
...@@ -8447,6 +8447,8 @@ cleanup: ...@@ -8447,6 +8447,8 @@ cleanup:
if (xml) if (xml)
xmlFreeDoc(xml); xmlFreeDoc(xml);
VIR_FREE(doc); VIR_FREE(doc);
for (i = 0; i < actual; i++)
VIR_FREE(names[i]);
VIR_FREE(names); VIR_FREE(names);
if (dom) if (dom)
virDomainFree(dom); virDomainFree(dom);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册