aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-hub.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb-hub.c')
-rw-r--r--hw/usb-hub.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index 0a39986468..e5a0938776 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -517,8 +517,12 @@ static int usb_hub_handle_packet(USBDevice *dev, USBPacket *p)
static void usb_hub_handle_destroy(USBDevice *dev)
{
USBHubState *s = (USBHubState *)dev;
+ int i;
- qemu_free(s);
+ for (i = 0; i < s->nb_ports; i++) {
+ usb_unregister_port(usb_bus_from_device(dev),
+ &s->ports[i].port);
+ }
}
static int usb_hub_initfn(USBDevice *dev)