Skip to content

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 <marcandre.lureau@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
  • 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
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.