mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +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;
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user