mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 06:25:19 +00:00
node_device_conf: use g_autoptr in virNodeDevCapPCIDevIommuGroupParseXML()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
fe7f725bf3
commit
b518f7b16f
@ -1581,7 +1581,6 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
|
|||||||
g_autofree char *numberStr = NULL;
|
g_autofree char *numberStr = NULL;
|
||||||
int nAddrNodes, ret = -1;
|
int nAddrNodes, ret = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
virPCIDeviceAddressPtr pciAddr = NULL;
|
|
||||||
|
|
||||||
ctxt->node = iommuGroupNode;
|
ctxt->node = iommuGroupNode;
|
||||||
|
|
||||||
@ -1603,14 +1602,10 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0; i < nAddrNodes; i++) {
|
for (i = 0; i < nAddrNodes; i++) {
|
||||||
virPCIDeviceAddress addr = {0};
|
g_autoptr(virPCIDeviceAddress) pciAddr = g_new0(virPCIDeviceAddress, 1);
|
||||||
if (virPCIDeviceAddressParseXML(addrNodes[i], &addr) < 0)
|
|
||||||
goto cleanup;
|
if (virPCIDeviceAddressParseXML(addrNodes[i], pciAddr) < 0)
|
||||||
pciAddr = g_new0(virPCIDeviceAddress, 1);
|
return -1;
|
||||||
pciAddr->domain = addr.domain;
|
|
||||||
pciAddr->bus = addr.bus;
|
|
||||||
pciAddr->slot = addr.slot;
|
|
||||||
pciAddr->function = addr.function;
|
|
||||||
if (VIR_APPEND_ELEMENT(pci_dev->iommuGroupDevices,
|
if (VIR_APPEND_ELEMENT(pci_dev->iommuGroupDevices,
|
||||||
pci_dev->nIommuGroupDevices,
|
pci_dev->nIommuGroupDevices,
|
||||||
pciAddr) < 0)
|
pciAddr) < 0)
|
||||||
@ -1619,7 +1614,6 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(pciAddr);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user