From 7c83a1e3c83e601f449f05e2e36e1df50e8503aa Mon Sep 17 00:00:00 2001 From: David Marchand Date: Wed, 16 Jun 2021 08:52:57 +0200 Subject: [PATCH] bus/pci: fix leak for unbound devices For devices not bound to any Linux kernel module, we leak a pci object since it is never added to the PCI bus device list. Fixes: c79a1c67465d ("bus/pci: optimize bus scan") Cc: stable@dpdk.org Reported-by: Owen Hilyard Signed-off-by: David Marchand --- drivers/bus/pci/linux/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 80ffe7633a..4d261b55ee 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -327,7 +327,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr) else 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.20.1