[PATCH 1/5] qemuBackupBegin: Don't leak 'def' on early failures

Peter Krempa pkrempa at redhat.com
Tue Jun 23 06:03:10 UTC 2020


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 <pkrempa at redhat.com>
---
 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 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)
-- 
2.26.2




More information about the libvir-list mailing list