diff options
author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2010-04-17 10:49:06 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2010-05-03 10:07:31 +0200 |
commit | 557df6aca2e389ef631b283ca1522b1fdf121eff (patch) | |
tree | 72bc4c6bd08e24bd7ee1c705260f4a227fa9be4c | |
parent | 6511ef77375100ecf9134f85f08cef31fd196cdf (diff) |
block: Set backing_hd to NULL after deleting it
It is safer to set backing_hd to NULL after deleting it so that any use
after deletion is obvious during development. Happy segfaulting!
This patch should be applied after Kevin Wolf's "vmdk: Convert to
bdrv_open" so that vmdk does not segfault on close.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | block.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -589,8 +589,10 @@ unlink_and_fail: void bdrv_close(BlockDriverState *bs) { if (bs->drv) { - if (bs->backing_hd) + if (bs->backing_hd) { bdrv_delete(bs->backing_hd); + bs->backing_hd = NULL; + } bs->drv->bdrv_close(bs); qemu_free(bs->opaque); #ifdef _WIN32 |