a41c76
From 1196c633f969dd9457b9b431fbcd944e35249b5f Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <1196c633f969dd9457b9b431fbcd944e35249b5f@dist-git>
a41c76
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
a41c76
Date: Tue, 4 Feb 2020 15:07:58 +0100
a41c76
Subject: [PATCH] qemu: snapshot: go through cleanup on error
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
A recent commit added an error check for too-nested backing chains
a41c76
followed by a return, even though errors above jump to cleanup.
a41c76
a41c76
Signed-off-by: Ján Tomko <jtomko@redhat.com>
a41c76
Fixes: b168fa88b85dec181882816ab65a59a6c4500667
a41c76
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
a41c76
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
a41c76
(cherry picked from commit c07ef7c563c7d661fd4b59bac190cd1db44bd3e5)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1524278
a41c76
Message-Id: <5903cd3cb7845ed3151492457a4e92e57a15fef0.1580824112.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_driver.c | 2 +-
a41c76
 1 file changed, 1 insertion(+), 1 deletion(-)
a41c76
a41c76
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
a41c76
index 833cf9f3d9..e19e1da0bb 100644
a41c76
--- a/src/qemu/qemu_driver.c
a41c76
+++ b/src/qemu/qemu_driver.c
a41c76
@@ -14633,7 +14633,7 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
a41c76
             snapdisk->src->format = VIR_STORAGE_FILE_QCOW2;
a41c76
 
a41c76
         if (qemuDomainStorageSourceValidateDepth(defdisk->src, 1, defdisk->dst) < 0)
a41c76
-            return -1;
a41c76
+            goto cleanup;
a41c76
 
a41c76
         /* creates cmd line args: qemu-img create -f qcow2 -o */
a41c76
         if (!(cmd = virCommandNewArgList(qemuImgPath,
a41c76
-- 
a41c76
2.25.0
a41c76