Received: from eggs.gnu.org ([2001:4830:134:3::10]:47020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPQp7-0001e3-Sc for qemu-devel@nongnu.org; Tue, 19 Jul 2016 04:56:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPQp5-0007pC-W8 for qemu-devel@nongnu.org; Tue, 19 Jul 2016 04:56:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPQp5-0007p0-Q9 for qemu-devel@nongnu.org; Tue, 19 Jul 2016 04:56:15 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56FB03B716 for ; Tue, 19 Jul 2016 08:56:15 +0000 (UTC) From: marcandre.lureau@redhat.com Date: Tue, 19 Jul 2016 12:54:25 +0400 Message-Id: <20160719085432.4572-31-marcandre.lureau@redhat.com> In-Reply-To: <20160719085432.4572-1-marcandre.lureau@redhat.com> References: <20160719085432.4572-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 30/37] usb: free USBDevice.strings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-Andr=C3=A9 Lureau 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=C3=A9 Lureau --- 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, Erro= r **errp) static void usb_qdev_unrealize(DeviceState *qdev, Error **errp) { USBDevice *dev =3D 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); + } =20 if (dev->attached) { usb_device_detach(dev); --=20 2.9.0