On 3/3/21 5:17 PM, Kristina Hanicova wrote:
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
src/conf/node_device_conf.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index cfc72299de..a64be74011 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1581,7 +1581,6 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
g_autofree char *numberStr = NULL;
int nAddrNodes, ret = -1;
size_t i;
- virPCIDeviceAddressPtr pciAddr = NULL;
ctxt->node = iommuGroupNode;
@@ -1603,14 +1602,9 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
goto cleanup;
for (i = 0; i < nAddrNodes; i++) {
- virPCIDeviceAddress addr = {0};
- if (virPCIDeviceAddressParseXML(addrNodes[i], &addr) < 0)
- goto cleanup;
- pciAddr = g_new0(virPCIDeviceAddress, 1);
- pciAddr->domain = addr.domain;
- pciAddr->bus = addr.bus;
- pciAddr->slot = addr.slot;
- pciAddr->function = addr.function;
+ g_autoptr(virPCIDeviceAddress) pciAddr = g_new0(virPCIDeviceAddress, 1);
+ if (virPCIDeviceAddressParseXML(addrNodes[i], pciAddr) < 0)
I know it's pre-existing, but since you're touching these lines anyway,
it would be nice to separate variable declaration block and code block
with an empty line.
+ return -1;
if (VIR_APPEND_ELEMENT(pci_dev->iommuGroupDevices,
pci_dev->nIommuGroupDevices,
pciAddr) < 0)
@@ -1619,7 +1613,6 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
ret = 0;
cleanup:
- VIR_FREE(pciAddr);
return ret;
}
Michal