usb:xhci:fix memory leak in usb_xhci_exit
authorLi Qiang <liqiang6-s@360.cn>
Tue, 13 Sep 2016 10:20:03 +0000 (03:20 -0700)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 13 Sep 2016 10:33:09 +0000 (12:33 +0200)
If the xhci uses msix, it doesn't free the corresponding
memory, thus leading a memory leak. This patch avoid this.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Message-id: 57d7d2e0.d4301c0a.d13e9.9a55@mx.google.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-xhci.c

index 37c1493..726435c 100644 (file)
@@ -3715,8 +3715,7 @@ static void usb_xhci_exit(PCIDevice *dev)
     /* destroy msix memory region */
     if (dev->msix_table && dev->msix_pba
         && dev->msix_entry_used) {
-        memory_region_del_subregion(&xhci->mem, &dev->msix_table_mmio);
-        memory_region_del_subregion(&xhci->mem, &dev->msix_pba_mmio);
+        msix_uninit(dev, &xhci->mem, &xhci->mem);
     }
 
     usb_bus_release(&xhci->bus);