[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/55] qemu-io: delete bs instead of leaking it
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 14/55] qemu-io: delete bs instead of leaking it |
Date: |
Mon, 31 Oct 2011 14:29:49 +0100 |
From: Stefan Hajnoczi <address@hidden>
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 <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-io.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/qemu-io.c b/qemu-io.c
index c45a413..5af887e 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1582,7 +1582,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;
}
@@ -1611,6 +1611,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;
}
@@ -1834,7 +1835,7 @@ int main(int argc, char **argv)
qemu_aio_flush();
if (bs) {
- bdrv_close(bs);
+ bdrv_delete(bs);
}
return 0;
}
--
1.7.6.4
- [Qemu-devel] [PATCH 04/55] qcow2: fix some errors and typo in qcow2.txt, (continued)
- [Qemu-devel] [PATCH 04/55] qcow2: fix some errors and typo in qcow2.txt, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 05/55] block: Remove dead code, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 06/55] block: Fix bdrv_open use after free, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 07/55] qcow: Fix bdrv_write_compressed error handling, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 09/55] vmdk: Fix use of uninitialised value, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 08/55] ide: Fix off-by-one error in array index check, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 12/55] Documentation: Describe NBD URL syntax, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 13/55] block: fix qcow2_co_flush deadlock, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 10/55] vmdk: Improve error handling, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 11/55] vmdk: Fix possible segfaults, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 14/55] qemu-io: delete bs instead of leaking it,
Kevin Wolf <=
- [Qemu-devel] [PATCH 15/55] block: set bs->read_only before .bdrv_open(), Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 17/55] Documentation: Add syntax for using sheepdog devices, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 16/55] block: reinitialize across bdrv_close()/bdrv_open(), Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 18/55] scsi: pass correct sense code for ENOMEDIUM, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 35/55] scsi: allow arbitrary LUNs, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 33/55] scsi: remove devs array from SCSIBus, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 38/55] scsi-disk: fix retrying a flush, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 37/55] scsi-disk: fail READ CAPACITY if LBA != 0 but PMI == 0, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 45/55] scsi-disk: remove cluster_size, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 44/55] scsi-disk: do not duplicate BlockDriverState member, Kevin Wolf, 2011/10/31