summaryrefslogtreecommitdiffstats
path: root/hw/virtio.c
diff options
context:
space:
mode:
authorAmit Shah2011-07-27 10:30:32 +0200
committerMichael S. Tsirkin2011-07-27 19:19:27 +0200
commit845f85fa1597c72609bd10a37b9586b445c13d49 (patch)
tree07f02316413edb06bb2e5b95c4507a492acbdaaa /hw/virtio.c
parentvirtio-net: don't use vdev after virtio_cleanup (diff)
downloadqemu-845f85fa1597c72609bd10a37b9586b445c13d49.tar.gz
qemu-845f85fa1597c72609bd10a37b9586b445c13d49.tar.xz
qemu-845f85fa1597c72609bd10a37b9586b445c13d49.zip
virtio: Plug memleak by freeing vdev
virtio_common_init() allocates RAM for the vdev struct (and any additional memory, depending on the size passed to the function). This memory wasn't being freed until now. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio.c')
-rw-r--r--hw/virtio.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/virtio.c b/hw/virtio.c
index a8f4940da2..93dfb1e359 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -834,6 +834,7 @@ void virtio_cleanup(VirtIODevice *vdev)
if (vdev->config)
qemu_free(vdev->config);
qemu_free(vdev->vq);
+ qemu_free(vdev);
}
static void virtio_vmstate_change(void *opaque, int running, int reason)