Commit ec507f11 authored by Marc-André Lureau's avatar Marc-André Lureau
Browse files

usb: free USBDevice.strings



The list is created during instance init and further populated with
usb_desc_set_string(). Clear it when unrealizing the device.

Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 0137a557
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);