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>
This commit is contained in:
Kevin Wolf 2011-03-31 12:39:51 +02:00
parent 6b837bc4a4
commit eb863add02
1 changed files with 6 additions and 2 deletions

View File

@ -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);