Received: from eggs.gnu.org ([2001:4830:134:3::10]:59885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWUL9-0000CE-Uo for qemu-devel@nongnu.org; Sun, 07 Aug 2016 16:06:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWUL8-0007Kp-04 for qemu-devel@nongnu.org; Sun, 07 Aug 2016 16:06:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59308) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWUL7-0007Kl-Qk for qemu-devel@nongnu.org; Sun, 07 Aug 2016 16:06:29 -0400 From: marcandre.lureau@redhat.com Date: Mon, 8 Aug 2016 00:05:59 +0400 Message-Id: <20160807200601.25905-8-marcandre.lureau@redhat.com> In-Reply-To: <20160807200601.25905-1-marcandre.lureau@redhat.com> References: <20160807200601.25905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL for-2.7 7/9] usb: free USBDevice.strings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?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