提交 3ced80b5 编写于 作者: L Laine Stump 提交者: Daniel Veillard

Fix a memory leak in virsh

* src/virsh.c: cmdNodeDeviceDumpXML wasn't freeing
  virNodeDeviceGetXMLDesc() return string
上级 96f0ee85
......@@ -5521,6 +5521,7 @@ cmdNodeDeviceDumpXML (vshControl *ctl, const vshCmd *cmd)
{
const char *name;
virNodeDevicePtr device;
char *xml;
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
return FALSE;
......@@ -5531,7 +5532,14 @@ cmdNodeDeviceDumpXML (vshControl *ctl, const vshCmd *cmd)
return FALSE;
}
vshPrint(ctl, "%s\n", virNodeDeviceGetXMLDesc(device, 0));
xml = virNodeDeviceGetXMLDesc(device, 0);
if (!xml) {
virNodeDeviceFree(device);
return FALSE;
}
vshPrint(ctl, "%s\n", xml);
free(xml);
virNodeDeviceFree(device);
return TRUE;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册