render / rpms / libvirt

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