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