mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
Fix a memory leak in virsh
* src/virsh.c: cmdNodeDeviceDumpXML wasn't freeing virNodeDeviceGetXMLDesc() return string
This commit is contained in:
parent
96f0ee85d2
commit
3ced80b54a
10
src/virsh.c
10
src/virsh.c
@ -5521,6 +5521,7 @@ cmdNodeDeviceDumpXML (vshControl *ctl, const vshCmd *cmd)
|
|||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
virNodeDevicePtr device;
|
virNodeDevicePtr device;
|
||||||
|
char *xml;
|
||||||
|
|
||||||
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
|
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -5531,7 +5532,14 @@ cmdNodeDeviceDumpXML (vshControl *ctl, const vshCmd *cmd)
|
|||||||
return FALSE;
|
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);
|
virNodeDeviceFree(device);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user