Skip to contentSkip to conversation

qemu-img rebase: Fix segfault if backing file can't be opened

PATCH In review Kevin Wolf 2 participants 2 messages Mar 31, 2011

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 qemu-img rebase: Fix segfault if backing file can't be opened

bdrv_delete must not be called for a NULL BlockDriverState.

---
 qemu-img.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
qemu-img.c +6 -2
index 074388c..d9c2c12 100644
@@ -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);
Signature · 1 line
1.7.2.3