Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
usb: free USBDevice.strings
Browse files Browse the repository at this point in the history
The list is created during instance init and further populated with
usb_desc_set_string(). Clear it when unrealizing the device.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
  • Loading branch information
elmarco committed Aug 7, 2016
1 parent 0137a55 commit ec507f1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hw/usb/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ static void usb_qdev_realize(DeviceState *qdev, Error **errp)
static void usb_qdev_unrealize(DeviceState *qdev, Error **errp)
{
USBDevice *dev = USB_DEVICE(qdev);
USBDescString *s, *next;

QLIST_FOREACH_SAFE(s, &dev->strings, next, next) {
QLIST_REMOVE(s, next);
g_free(s->str);
g_free(s);
}

if (dev->attached) {
usb_device_detach(dev);
Expand Down

0 comments on commit ec507f1

Please sign in to comment.