[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 29/37] usb: free USBDevice.strings
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v2 29/37] usb: free USBDevice.strings |
Date: |
Thu, 28 Jul 2016 18:38:00 +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] [PATCH v2 20/37] char: free MuxDriver when closing, (continued)
- [Qemu-devel] [PATCH v2 20/37] char: free MuxDriver when closing, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 21/37] tests: fix qom-test leaks, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 22/37] pc: free i8259, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 23/37] pc: keep gsi reference, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 24/37] ahci: free irqs array, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 25/37] sd: free timer, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 26/37] qjson: free str, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 27/37] virtio-input: free config list, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 28/37] ipmi: free extern timer, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 29/37] usb: free USBDevice.strings,
marcandre . lureau <=
- [Qemu-devel] [PATCH v2 30/37] tests: free a bunch of qmp responses, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 31/37] usb: free leaking path, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 32/37] bus: simplify name handling, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 33/37] tests: add qtest_add_data_func_full, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 34/37] tests: pc-cpu-test leaks fixes, marcandre . lureau, 2016/07/28
- [Qemu-devel] [PATCH v2 35/37] tests: fix rsp leak in postcopy-test, marcandre . lureau, 2016/07/28