* [Qemu-devel] [PATCH] qemu-io: delete bs instead of leaking it
@ 2011-10-27 7:42 Stefan Hajnoczi
2011-10-27 8:47 ` Kevin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2011-10-27 7:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-27 8:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-27 7:42 [Qemu-devel] [PATCH] qemu-io: delete bs instead of leaking it Stefan Hajnoczi
2011-10-27 8:47 ` Kevin Wolf
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).