From e6da08c28ab8c9a7fe8255510253f87ac9a88b53 Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Mon, 15 Jan 2018 12:32:58 +0100 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/394703 Reviewed-by: Reviewed-by: Pawel Wodkowski Reviewed-by: Daniel Verkamp Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris --- lib/virtio/virtio_pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/virtio/virtio_pci.c b/lib/virtio/virtio_pci.c index 883cef933..3e8ec9295 100644 --- a/lib/virtio/virtio_pci.c +++ b/lib/virtio/virtio_pci.c @@ -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