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