libvirt/SOURCES/libvirt-qemu-backup-Initialize-store-source-properly-and-just-once.patch
2021-10-08 13:11:20 +00:00

50 lines
1.8 KiB
Diff

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