qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PULL for-2.7 7/9] usb: free USBDevice.strings
Date: Mon,  8 Aug 2016 00:05:59 +0400	[thread overview]
Message-ID: <20160807200601.25905-8-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20160807200601.25905-1-marcandre.lureau@redhat.com>

From: Marc-André Lureau <marcandre.lureau@redhat.com>

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>
---
 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

  parent reply	other threads:[~2016-08-07 20:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-07 20:05 [Qemu-devel] [PULL for-2.7 0/9] Leak fixes for 2.7 marcandre.lureau
2016-08-07 20:05 ` [Qemu-devel] [PULL for-2.7 1/9] numa: do not leak NumaOptions marcandre.lureau
2016-08-07 20:05 ` [Qemu-devel] [PULL for-2.7 2/9] char: free the tcp connection data when closing marcandre.lureau
2016-08-07 20:05 ` [Qemu-devel] [PULL for-2.7 3/9] char: free MuxDriver " marcandre.lureau
2016-08-07 20:05 ` [Qemu-devel] [PULL for-2.7 4/9] ahci: free irqs array marcandre.lureau
2016-08-07 20:05 ` [Qemu-devel] [PULL for-2.7 5/9] qjson: free str marcandre.lureau
2016-08-07 20:05 ` [Qemu-devel] [PULL for-2.7 6/9] virtio-input: free config list marcandre.lureau
2016-08-07 20:05 ` marcandre.lureau [this message]
2016-08-07 20:06 ` [Qemu-devel] [PULL for-2.7 8/9] usb: free leaking path marcandre.lureau
2016-08-07 20:06 ` [Qemu-devel] [PULL for-2.7 9/9] ahci: fix sglist leak on retry marcandre.lureau
2016-08-08 12:25 ` [Qemu-devel] [PULL for-2.7 0/9] Leak fixes for 2.7 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160807200601.25905-8-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).