a41c76
From 148ee94fdde4b4b6a78ff2a734a2bc9105a81166 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <148ee94fdde4b4b6a78ff2a734a2bc9105a81166@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 23 Jun 2020 12:24:07 +0200
a41c76
Subject: [PATCH] qemuBackupBegin: Don't leak 'def' on early failures
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
The cleanup path expects that 'def' is assigned to 'priv->backup', but
a41c76
that's not the case for early failures. Add a check to stop overwriting
a41c76
of 'def' so that it can be freed.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit b5212365b640fceb7116dca30518b42bf6ab42df)
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
a41c76
Message-Id: <18f55f981e9a6eba7266424fb0f244a2c7102508.1592906423.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_backup.c | 2 +-
a41c76
 1 file changed, 1 insertion(+), 1 deletion(-)
a41c76
a41c76
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
a41c76
index 67d646f477..c207d3b7d0 100644
a41c76
--- a/src/qemu/qemu_backup.c
a41c76
+++ b/src/qemu/qemu_backup.c
a41c76
@@ -803,7 +803,7 @@ qemuBackupBegin(virDomainObjPtr vm,
a41c76
         ignore_value(qemuDomainObjExitMonitor(priv->driver, vm));
a41c76
     }
a41c76
 
a41c76
-    if (ret < 0 && !job_started)
a41c76
+    if (ret < 0 && !job_started && priv->backup)
a41c76
         def = g_steal_pointer(&priv->backup);
a41c76
 
a41c76
     if (ret == 0)
a41c76
-- 
a41c76
2.27.0
a41c76