From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVaT4-0003Q4-AP for qemu-devel@nongnu.org; Fri, 05 Aug 2016 04:26:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bVaT1-0002dy-TS for qemu-devel@nongnu.org; Fri, 05 Aug 2016 04:26:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVaT1-0002du-Ns for qemu-devel@nongnu.org; Fri, 05 Aug 2016 04:26:55 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 5B6F53BEAB for ; Fri, 5 Aug 2016 08:26:55 +0000 (UTC) From: marcandre.lureau@redhat.com Date: Fri, 5 Aug 2016 12:24:14 +0400 Message-Id: <20160805082421.21994-30-marcandre.lureau@redhat.com> In-Reply-To: <20160805082421.21994-1-marcandre.lureau@redhat.com> References: <20160805082421.21994-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 for-2.7 v4 29/36] usb: free USBDevice.strings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, =?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 Reviewed-by: Gerd Hoffmann --- 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