virtio: Plug memleak by freeing vdev
authorAmit Shah <amit.shah@redhat.com>
Wed, 27 Jul 2011 08:30:32 +0000 (14:00 +0530)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 27 Jul 2011 17:19:27 +0000 (20:19 +0300)
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>
hw/virtio.c

index a8f4940..93dfb1e 100644 (file)
@@ -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)