Commit 6b21b973ab9aa2bfc3ebfe1df4474466ceb4d88b
1 parent
2192c332
fixed error handling
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2133 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
3 additions
and
1 deletions
block.c
... | ... | @@ -365,6 +365,8 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, |
365 | 365 | } |
366 | 366 | if (ret < 0) { |
367 | 367 | qemu_free(bs->opaque); |
368 | + bs->opaque = NULL; | |
369 | + bs->drv = NULL; | |
368 | 370 | return ret; |
369 | 371 | } |
370 | 372 | if (drv->bdrv_getlength) { |
... | ... | @@ -381,7 +383,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, |
381 | 383 | if (!bs->backing_hd) { |
382 | 384 | fail: |
383 | 385 | bdrv_close(bs); |
384 | - return -1; | |
386 | + return -ENOMEM; | |
385 | 387 | } |
386 | 388 | path_combine(backing_filename, sizeof(backing_filename), |
387 | 389 | filename, bs->backing_file); | ... | ... |