mem: fix mem leak issue when attaching a PCI device without driver to DPDK
Checks
Commit Message
when trying to attach a PCI device without driver to DPDK,
the 'dev' is malloced but not freed.
Signed-off-by: RickZhong <winsome8282@163.com>
---
drivers/bus/pci/linux/pci.c | 1 +
1 file changed, 1 insertion(+)
Comments
On Mon, Jun 28, 2021 at 11:03 AM RickZhong <winsome8282@163.com> wrote:
>
> when trying to attach a PCI device without driver to DPDK,
> the 'dev' is malloced but not freed.
>
> Signed-off-by: RickZhong <winsome8282@163.com>
Thanks for the patch.
I already submitted a similar fix.
https://patchwork.dpdk.org/project/dpdk/patch/20210616065257.16044-1-david.marchand@redhat.com/
@@ -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) */