From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH] qemu-io: delete bs instead of leaking it
Date: Thu, 27 Oct 2011 08:42:13 +0100 [thread overview]
Message-ID: <1319701333-5700-1-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
Using bdrv_close() is not enough to free a BlockDriverState. Since we
explicitly create it with bdrv_new(), use bdrv_delete() to close and
delete it.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
qemu-io.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/qemu-io.c b/qemu-io.c
index e91af37..e8ac704 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1581,7 +1581,7 @@ static const cmdinfo_t map_cmd = {
static int close_f(int argc, char **argv)
{
- bdrv_close(bs);
+ bdrv_delete(bs);
bs = NULL;
return 0;
}
@@ -1610,6 +1610,7 @@ static int openfile(char *name, int flags, int growable)
if (bdrv_open(bs, name, flags, NULL) < 0) {
fprintf(stderr, "%s: can't open device %s\n", progname, name);
+ bdrv_delete(bs);
bs = NULL;
return 1;
}
--
1.7.7
next reply other threads:[~2011-10-27 8:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-27 7:42 Stefan Hajnoczi [this message]
2011-10-27 8:47 ` [Qemu-devel] [PATCH] qemu-io: delete bs instead of leaking it Kevin Wolf
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=1319701333-5700-1-git-send-email-stefanha@linux.vnet.ibm.com \
--to=stefanha@linux.vnet.ibm.com \
--cc=kwolf@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).