[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL for-2.7 7/9] usb: free USBDevice.strings
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PULL for-2.7 7/9] usb: free USBDevice.strings |
Date: |
Mon, 8 Aug 2016 00:05:59 +0400 |
From: Marc-André Lureau <address@hidden>
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 <address@hidden>
Reviewed-by: Gerd Hoffmann <address@hidden>
---
hw/usb/bus.c | 7 +++++++
1 file changed, 7 insertions(+)
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);
--
2.9.0
- [Qemu-devel] [PULL for-2.7 0/9] Leak fixes for 2.7, marcandre . lureau, 2016/08/07
- [Qemu-devel] [PULL for-2.7 1/9] numa: do not leak NumaOptions, marcandre . lureau, 2016/08/07
- [Qemu-devel] [PULL for-2.7 2/9] char: free the tcp connection data when closing, marcandre . lureau, 2016/08/07
- [Qemu-devel] [PULL for-2.7 3/9] char: free MuxDriver when closing, marcandre . lureau, 2016/08/07
- [Qemu-devel] [PULL for-2.7 4/9] ahci: free irqs array, marcandre . lureau, 2016/08/07
- [Qemu-devel] [PULL for-2.7 5/9] qjson: free str, marcandre . lureau, 2016/08/07
- [Qemu-devel] [PULL for-2.7 6/9] virtio-input: free config list, marcandre . lureau, 2016/08/07
- [Qemu-devel] [PULL for-2.7 7/9] usb: free USBDevice.strings,
marcandre . lureau <=
- [Qemu-devel] [PULL for-2.7 8/9] usb: free leaking path, marcandre . lureau, 2016/08/07
- [Qemu-devel] [PULL for-2.7 9/9] ahci: fix sglist leak on retry, marcandre . lureau, 2016/08/07
- Re: [Qemu-devel] [PULL for-2.7 0/9] Leak fixes for 2.7, Peter Maydell, 2016/08/08