diff options
author | Kevin Wolf <kwolf@redhat.com> | 2011-03-31 12:39:51 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-04-07 13:51:48 +0200 |
commit | eb863add0204210480d018a3298ca22e4eadf3ce (patch) | |
tree | 2f38b85a80b23733071f0c1e3262624fae968119 /qemu-img.c | |
parent | 6b837bc4a4d81861027c74f882d8c1d43f4ec30c (diff) |
qemu-img rebase: Fix segfault if backing file can't be opened
bdrv_delete must not be called for a NULL BlockDriverState.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r-- | qemu-img.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/qemu-img.c b/qemu-img.c index 074388ce89..d9c2c12fa0 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1411,8 +1411,12 @@ out: qemu_progress_end(); /* Cleanup */ if (!unsafe) { - bdrv_delete(bs_old_backing); - bdrv_delete(bs_new_backing); + if (bs_old_backing != NULL) { + bdrv_delete(bs_old_backing); + } + if (bs_new_backing != NULL) { + bdrv_delete(bs_new_backing); + } } bdrv_delete(bs); |