qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>, Amit Shah <amit.shah@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH 4/4] virtio: Plug memleak by freeing vdev
Date: Wed, 27 Jul 2011 14:00:32 +0530	[thread overview]
Message-ID: <0139341db2e3b0402f2396b78daf535fe182044e.1311755243.git.amit.shah@redhat.com> (raw)
In-Reply-To: <cover.1311755243.git.amit.shah@redhat.com>
In-Reply-To: <cover.1311755243.git.amit.shah@redhat.com>

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(-)

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)
-- 
1.7.6

  parent reply	other threads:[~2011-07-27  8:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27  8:30 [Qemu-devel] [PATCH 0/4] Fix virtio memleaks Amit Shah
2011-07-27  8:30 ` [Qemu-devel] [PATCH 1/4] virtio-balloon: Add exit handler, fix memleaks Amit Shah
2011-07-27  8:30 ` [Qemu-devel] [PATCH 2/4] virtio-blk: Fix memleak on exit Amit Shah
2011-07-27  9:07   ` Kevin Wolf
2011-07-27  8:30 ` [Qemu-devel] [PATCH 3/4] virtio-net: Fix potential use-after-free Amit Shah
2011-07-27  8:43   ` Michael S. Tsirkin
2011-07-27  8:51     ` Amit Shah
2011-07-27  8:30 ` Amit Shah [this message]
2011-07-27  9:08 ` [Qemu-devel] [PATCH 0/4] Fix virtio memleaks Michael S. Tsirkin
2011-07-27 10:15   ` Amit Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0139341db2e3b0402f2396b78daf535fe182044e.1311755243.git.amit.shah@redhat.com \
    --to=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).