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>
This commit is contained in:
parent
ea2afcf5b6
commit
0f5a15e40a
@ -32,7 +32,7 @@ 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 *
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user