diff options
Diffstat (limited to 'hw/usb-net.c')
-rw-r--r-- | hw/usb-net.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/hw/usb-net.c b/hw/usb-net.c index 863c25fd9c..9e6442506f 100644 --- a/hw/usb-net.c +++ b/hw/usb-net.c @@ -1415,14 +1415,20 @@ static int usbnet_can_receive(void *opaque) return !s->in_len; } +static void usbnet_cleanup(VLANClientState *vc) +{ + USBNetState *s = vc->opaque; + + rndis_clear_responsequeue(s); + qemu_free(s); +} + static void usb_net_handle_destroy(USBDevice *dev) { USBNetState *s = (USBNetState *) dev; /* TODO: remove the nd_table[] entry */ qemu_del_vlan_client(s->vc); - rndis_clear_responsequeue(s); - qemu_free(s); } USBDevice *usb_net_init(NICInfo *nd) @@ -1452,7 +1458,9 @@ USBDevice *usb_net_init(NICInfo *nd) pstrcpy(s->dev.devname, sizeof(s->dev.devname), "QEMU USB Network Interface"); s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, - usbnet_receive, usbnet_can_receive, s); + usbnet_receive, + usbnet_can_receive, + usbnet_cleanup, s); qemu_format_nic_info_str(s->vc, s->mac); |