[dpdk-dev] [PATCH] mem: fix mem leak issue when attaching a PCI device without driver to DPDK

RickZhong winsome8282 at 163.com
Mon Jun 28 11:02:49 CEST 2021


when trying to attach a PCI device without driver to DPDK,
the 'dev' is malloced but not freed.

Signed-off-by: RickZhong <winsome8282 at 163.com>
---
 drivers/bus/pci/linux/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 0dc99e9cb..909502ecc 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -332,6 +332,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 			dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 	} else {
 		dev->kdrv = RTE_PCI_KDRV_NONE;
+		free(dev);
 		return 0;
 	}
 	/* device is valid, add in list (sorted) */
-- 
2.18.4




More information about the dev mailing list