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 6/9] virtio-input: free config list
Date: Mon, 8 Aug 2016 00:05:58 +0400 [thread overview]
Message-ID: <20160807200601.25905-7-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20160807200601.25905-1-marcandre.lureau@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Clear the list when finalizing. The list is created during realize with
virtio_input_idstr_config() and later by further calls to
virtio_input_init_config() and virtio_input_add_config().
This leak can be reproduced with device-introspect-test -p
/x86_64/device/introspect/concrete.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/input/virtio-input.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c
index a87fd68..ccdf730 100644
--- a/hw/input/virtio-input.c
+++ b/hw/input/virtio-input.c
@@ -270,6 +270,16 @@ static void virtio_input_device_realize(DeviceState *dev, Error **errp)
vinput->sts = virtio_add_queue(vdev, 64, virtio_input_handle_sts);
}
+static void virtio_input_finalize(Object *obj)
+{
+ VirtIOInput *vinput = VIRTIO_INPUT(obj);
+ VirtIOInputConfig *cfg, *next;
+
+ QTAILQ_FOREACH_SAFE(cfg, &vinput->cfg_list, node, next) {
+ QTAILQ_REMOVE(&vinput->cfg_list, cfg, node);
+ g_free(cfg);
+ }
+}
static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
{
VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(dev);
@@ -318,6 +328,7 @@ static const TypeInfo virtio_input_info = {
.class_size = sizeof(VirtIOInputClass),
.class_init = virtio_input_class_init,
.abstract = true,
+ .instance_finalize = virtio_input_finalize,
};
/* ----------------------------------------------------------------- */
--
2.9.0
next prev 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 ` marcandre.lureau [this message]
2016-08-07 20:05 ` [Qemu-devel] [PULL for-2.7 7/9] usb: free USBDevice.strings marcandre.lureau
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-7-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).