diff options
author | Ladi Prosek <lprosek@redhat.com> | 2017-03-24 15:24:49 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2017-03-27 12:14:44 +0200 |
commit | 0f5a15e40ad1512c70d1323a73c7b073e32e17ee (patch) | |
tree | f2134a23219b9c8821a0117ff3791e6c2df8a2f7 /hw/input | |
parent | ea2afcf5b6727a577cf561fd8fe0d8c397ecc927 (diff) |
virtio-input: free event queue when finalizing
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 <lprosek@redhat.com>
Message-id: 1490365490-4854-2-git-send-email-lprosek@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/input')
-rw-r--r-- | hw/input/virtio-input.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c index b678ee9f20..728832aa62 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) { |