[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL for-2.9 1/5] virtio-input: free event queue when fina
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL for-2.9 1/5] virtio-input: free event queue when finalizing |
Date: |
Mon, 27 Mar 2017 15:28:33 +0200 |
From: Ladi Prosek <address@hidden>
VirtIOInput.queue was never freed. This commit adds an explicit
g_free to virtio_input_finalize and switches the allocation
function from realloc to g_realloc in virtio_input_send.
Signed-off-by: Ladi Prosek <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/input/virtio-input.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c
index b678ee9..728832a 100644
--- a/hw/input/virtio-input.c
+++ b/hw/input/virtio-input.c
@@ -32,8 +32,8 @@ void virtio_input_send(VirtIOInput *vinput,
virtio_input_event *event)
/* queue up events ... */
if (vinput->qindex == vinput->qsize) {
vinput->qsize++;
- vinput->queue = realloc(vinput->queue, vinput->qsize *
- sizeof(virtio_input_event));
+ vinput->queue = g_realloc(vinput->queue, vinput->qsize *
+ sizeof(virtio_input_event));
}
vinput->queue[vinput->qindex++] = *event;
@@ -272,6 +272,8 @@ static void virtio_input_finalize(Object *obj)
QTAILQ_REMOVE(&vinput->cfg_list, cfg, node);
g_free(cfg);
}
+
+ g_free(vinput->queue);
}
static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
{
--
1.8.3.1
- [Qemu-devel] [PULL for-2.9 0/5] fixes for 2.9: vga, egl, cirrus, virtio-input., Gerd Hoffmann, 2017/03/27
- [Qemu-devel] [PULL for-2.9 4/5] ui/egl-helpers: fix egl 1.5 display init, Gerd Hoffmann, 2017/03/27
- [Qemu-devel] [PULL for-2.9 3/5] cirrus: fix PUTPIXEL macro, Gerd Hoffmann, 2017/03/27
- [Qemu-devel] [PULL for-2.9 5/5] vnc: fix reverse mode, Gerd Hoffmann, 2017/03/27
- [Qemu-devel] [PULL for-2.9 2/5] virtio-input: fix eventq batching, Gerd Hoffmann, 2017/03/27
- [Qemu-devel] [PULL for-2.9 1/5] virtio-input: free event queue when finalizing,
Gerd Hoffmann <=
- Re: [Qemu-devel] [PULL for-2.9 0/5] fixes for 2.9: vga, egl, cirrus, virtio-input., Peter Maydell, 2017/03/27