a41c76
From 7ffdca30e2d5c80e68846df2656efed0e13a81d4 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <7ffdca30e2d5c80e68846df2656efed0e13a81d4@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 23 Jun 2020 12:24:08 +0200
a41c76
Subject: [PATCH] qemu: backup: Initialize 'store' source properly and just
a41c76
 once
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Two functions called in sequence both initialized the virStorageSource
a41c76
backing 'store' leading to a memleak.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 2d26f8b710d259a3e164a2bea3c9f9dc0de9b419)
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
a41c76
Message-Id: <0e2df46f3a2ffd182e21d54497bafcfc09b26b0d.1592906423.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_backup.c | 5 +----
a41c76
 1 file changed, 1 insertion(+), 4 deletions(-)
a41c76
a41c76
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
a41c76
index c207d3b7d0..013a82e06d 100644
a41c76
--- a/src/qemu/qemu_backup.c
a41c76
+++ b/src/qemu/qemu_backup.c
a41c76
@@ -269,9 +269,6 @@ qemuBackupDiskPrepareDataOne(virDomainObjPtr vm,
a41c76
         dd->backingStore = dd->terminator = virStorageSourceNew();
a41c76
     }
a41c76
 
a41c76
-    if (qemuDomainStorageFileInit(priv->driver, vm, dd->store, dd->domdisk->src) < 0)
a41c76
-        return -1;
a41c76
-
a41c76
     if (qemuDomainPrepareStorageSourceBlockdev(NULL, dd->store, priv, cfg) < 0)
a41c76
         return -1;
a41c76
 
a41c76
@@ -407,7 +404,7 @@ qemuBackupDiskPrepareOneStorage(virDomainObjPtr vm,
a41c76
             return -1;
a41c76
         }
a41c76
 
a41c76
-        if (qemuDomainStorageFileInit(priv->driver, vm, dd->store, NULL) < 0)
a41c76
+        if (qemuDomainStorageFileInit(priv->driver, vm, dd->store, dd->domdisk->src) < 0)
a41c76
             return -1;
a41c76
 
a41c76
         dd->initialized = true;
a41c76
-- 
a41c76
2.27.0
a41c76