summaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c8
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);