virtio/pci: detach pci device on virtio-pci destroy

Fix memory leak on virtio-pci device destruct.

Change-Id: I7d33802bc15c15d6a2dbac3e83456c9cf23b6004
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/394703
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2018-01-15 12:32:58 +01:00 committed by Jim Harris
parent 0d6a37c7d9
commit e6da08c28a

View File

@ -207,9 +207,11 @@ static void
modern_destruct_dev(struct virtio_dev *vdev)
{
struct virtio_hw *hw = vdev->ctx;
struct spdk_pci_device *pci_dev = hw->pci_dev;
free_virtio_hw(hw);
free(vdev->name);
spdk_pci_device_detach(pci_dev);
}
static uint8_t