qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wen Congyang <wency@cn.fujitsu.com>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] fix memory leak when we uninit a drive
Date: Wed, 16 Feb 2011 10:23:58 +0800	[thread overview]
Message-ID: <4D5B353E.2060500@cn.fujitsu.com> (raw)

We alloc memory for dinfo->id, so we should free it in
the function drive_uninit().

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>

---
 blockdev.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index ecfadc1..1333a4e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -183,6 +183,8 @@ static void drive_uninit(DriveInfo *dinfo)
     qemu_opts_del(dinfo->opts);
     bdrv_delete(dinfo->bdrv);
     QTAILQ_REMOVE(&drives, dinfo, next);
+    if (dinfo->id)
+        qemu_free(dinfo->id);
     qemu_free(dinfo);
 }
 
-- 
1.7.1

             reply	other threads:[~2011-02-16  2:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-16  2:23 Wen Congyang [this message]
2011-02-16  9:43 ` [Qemu-devel] [PATCH] fix memory leak when we uninit a drive Markus Armbruster

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=4D5B353E.2060500@cn.fujitsu.com \
    --to=wency@cn.fujitsu.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).