summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-08-23 21:14:37 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-08-23 21:14:37 +0000
commit6b21b973ab9aa2bfc3ebfe1df4474466ceb4d88b (patch)
tree964ab1307626c7e1737f15164527bf9cfaf09361 /block.c
parent2192c33250878c6e9c78820766afe42b73fd1c2f (diff)
fixed error handling
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2133 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block.c')
-rw-r--r--block.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block.c b/block.c
index 885b70023..3b35500b7 100644
--- a/block.c
+++ b/block.c
@@ -365,6 +365,8 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
}
if (ret < 0) {
qemu_free(bs->opaque);
+ bs->opaque = NULL;
+ bs->drv = NULL;
return ret;
}
if (drv->bdrv_getlength) {
@@ -381,7 +383,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
if (!bs->backing_hd) {
fail:
bdrv_close(bs);
- return -1;
+ return -ENOMEM;
}
path_combine(backing_filename, sizeof(backing_filename),
filename, bs->backing_file);