render / rpms / libvirt

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