[PATCH] fix memleak in virNodeDeviceGetPCISRIOVCaps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jiang Kun <jiang.kun2@xxxxxxxxxx>

it always alloc new memory when get dumpxml of pf device,but never free it.
Now free the old first,then alloc new memory.

Signed-off-by: Jiang kun <jiang.kun2@xxxxxxxxxx>
---
 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 e51371d..618ce8e 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;
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux