mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virNodeDevPCICapSRIOVVirtualParseXML: fix memleak of addr
virPCIDeviceAddressPtr 'addr' is forgotten to be freed in the branch 'VIR_APPEND_ELEMENT() < 0'. Use g_autoptr instead. Signed-off-by: Hao Wang <wanghao232@huawei.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
347de9b3c0
commit
f7f5b86be2
@ -1489,15 +1489,13 @@ virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextPtr ctxt,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0; i < naddresses; i++) {
|
for (i = 0; i < naddresses; i++) {
|
||||||
virPCIDeviceAddressPtr addr = NULL;
|
g_autoptr(virPCIDeviceAddress) addr = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(addr) < 0)
|
if (VIR_ALLOC(addr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virPCIDeviceAddressParseXML(addresses[i], addr) < 0) {
|
if (virPCIDeviceAddressParseXML(addresses[i], addr) < 0)
|
||||||
VIR_FREE(addr);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (VIR_APPEND_ELEMENT(pci_dev->virtual_functions,
|
if (VIR_APPEND_ELEMENT(pci_dev->virtual_functions,
|
||||||
pci_dev->num_virtual_functions,
|
pci_dev->num_virtual_functions,
|
||||||
|
Loading…
Reference in New Issue
Block a user