bus/pci: fix memory leak in device cleanup

During PCI bus device cleanup some interrupt handle pointers and the
bus_info pointer are not being free'd, leading to memory leaks.
This patch fixes the memory leaks by ensuring they are free'd during
device cleanup on exit.

Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Tested-by: Weiyuan Li <weiyuanx.li@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
Kevin Laatz 2022-10-19 13:37:43 +01:00 committed by David Marchand
parent a74b1b2513
commit d5c398741d

View File

@ -456,7 +456,14 @@ pci_cleanup(void)
}
dev->driver = NULL;
dev->device.driver = NULL;
free(dev);
/* free interrupt handles */
rte_intr_instance_free(dev->intr_handle);
dev->intr_handle = NULL;
rte_intr_instance_free(dev->vfio_req_intr_handle);
dev->vfio_req_intr_handle = NULL;
pci_free(dev);
}
return error;