diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-07-15 11:14:07 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-08-08 00:00:32 +0400 |
commit | ec507f112361ddf6dac0f0a30e84d9da1b4910b6 (patch) | |
tree | 70358063d9e32689738fe30bee37234b12d8ace5 /hw/usb | |
parent | 0137a557aac07480ff8447ef372f0581af5ee65a (diff) | |
download | qemu-ec507f112361ddf6dac0f0a30e84d9da1b4910b6.zip qemu-ec507f112361ddf6dac0f0a30e84d9da1b4910b6.tar.gz qemu-ec507f112361ddf6dac0f0a30e84d9da1b4910b6.tar.bz2 |
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: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r-- | hw/usb/bus.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/usb/bus.c b/hw/usb/bus.c index c28ccb8..25913ad 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -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); |