aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-11-21 13:56:49 +0400
committerMichael S. Tsirkin <mst@redhat.com>2019-11-25 03:19:36 -0500
commit509ec36c1e4c559e90115a16403dea8d92dff335 (patch)
tree85c00413a44aab6d8781de76037dabc62284ecd3 /hw
parent2061735ff09f9d5e67c501a96227b470e7de69b1 (diff)
downloadqemu-509ec36c1e4c559e90115a16403dea8d92dff335.zip
qemu-509ec36c1e4c559e90115a16403dea8d92dff335.tar.gz
qemu-509ec36c1e4c559e90115a16403dea8d92dff335.tar.bz2
virtio-input: fix memory leak on unrealize
Spotted by ASAN + minor stylistic change. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20191121095649.25453-1-marcandre.lureau@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/input/virtio-input.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c
index 51617a5..ec54e46 100644
--- a/hw/input/virtio-input.c
+++ b/hw/input/virtio-input.c
@@ -275,6 +275,7 @@ static void virtio_input_finalize(Object *obj)
g_free(vinput->queue);
}
+
static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
{
VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(dev);
@@ -288,6 +289,8 @@ static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
return;
}
}
+ virtio_del_queue(vdev, 0);
+ virtio_del_queue(vdev, 1);
virtio_cleanup(vdev);
}