From bf5ba702bb7cbd362a2dc6b278e083e7e475dcff Mon Sep 17 00:00:00 2001
From: Feng Ni <fengni@huawei.com>
Date: Thu, 25 Jul 2019 20:13:09 +0800
Subject: [PATCH] conf: fix memory leak in virNodeDeviceGetPCISRIOVCaps

Use API nodeDeviceLookupByName query FPGA device info,
pointer physical_function should be released.

Signed-off-by: Feng Ni <fengni@huawei.com>
---
 src/conf/node_device_conf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 4ef92d5..0c804f5 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -2509,6 +2509,7 @@ virNodeDeviceGetPCISRIOVCaps(const char *sysfsPath,
     for (i = 0; i < pci_dev->num_virtual_functions; i++)
        VIR_FREE(pci_dev->virtual_functions[i]);
     VIR_FREE(pci_dev->virtual_functions);
+    VIR_FREE(pci_dev->physical_function);
     pci_dev->num_virtual_functions = 0;
     pci_dev->max_virtual_functions = 0;
     pci_dev->flags &= ~VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
-- 
2.19.1

