Patchwork [4/4] virtio: Plug memleak by freeing vdev

login
register
mail settings
Submitter Amit Shah
Date July 27, 2011, 8:30 a.m.
Message ID <0139341db2e3b0402f2396b78daf535fe182044e.1311755243.git.amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/106995/
State New
Headers show

Comments

Amit Shah - July 27, 2011, 8:30 a.m.
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>
---
 hw/virtio.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/virtio.c b/hw/virtio.c
index a8f4940..93dfb1e 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)