render / rpms / libvirt

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