From: Peter Krempa Date: Tue, 23 Jun 2020 05:33:41 +0000 (+0200) Subject: qemuBackupBegin: Don't leak 'def' on early failures X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b5212365b640fceb7116dca30518b42bf6ab42df;p=libvirt.git qemuBackupBegin: Don't leak 'def' on early failures 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 --- diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index db8b2d8ff9..531005425b 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -806,7 +806,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)