qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] qemu-img rebase: Fix segfault if backing file can't


From: Kevin Wolf
Subject: [Qemu-devel] [PATCH] qemu-img rebase: Fix segfault if backing file can't be opened
Date: Thu, 31 Mar 2011 12:41:37 +0200

bdrv_delete must not be called for a NULL BlockDriverState.

Signed-off-by: Kevin Wolf <address@hidden>
---
 qemu-img.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index 074388c..d9c2c12 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);
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]