|
|
fbe740 |
From 3e6ecac77da1e9f302f81a68dded6bd226430682 Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <3e6ecac77da1e9f302f81a68dded6bd226430682@dist-git>
|
|
|
fbe740 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Date: Tue, 4 Feb 2020 15:08:06 +0100
|
|
|
fbe740 |
Subject: [PATCH] qemuMigrationCookieAddNBD: Use virHashNew and automatic
|
|
|
fbe740 |
freeing of virHashTablePtr
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
Swithc to the helper which doesn't require checking of the return value.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit 45eefb2c78cfe2b14d5bc5fb150ffbed18991fde)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1793263
|
|
|
fbe740 |
Message-Id: <06db6f97ebb2266ea197ce13cbc9051e4c839fdf.1580824112.git.pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/qemu/qemu_migration_cookie.c | 6 +-----
|
|
|
fbe740 |
1 file changed, 1 insertion(+), 5 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
|
|
|
fbe740 |
index 33ab6cb7a5..968a9b589c 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_migration_cookie.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_migration_cookie.c
|
|
|
fbe740 |
@@ -454,7 +454,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
|
|
fbe740 |
virDomainObjPtr vm)
|
|
|
fbe740 |
{
|
|
|
fbe740 |
qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
fbe740 |
- virHashTablePtr stats = NULL;
|
|
|
fbe740 |
+ g_autoptr(virHashTable) stats = virHashNew(virHashValueFree);
|
|
|
fbe740 |
size_t i;
|
|
|
fbe740 |
int ret = -1, rc;
|
|
|
fbe740 |
|
|
|
fbe740 |
@@ -472,9 +472,6 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
|
|
fbe740 |
mig->nbd->disks = g_new0(struct qemuMigrationCookieNBDDisk, vm->def->ndisks);
|
|
|
fbe740 |
mig->nbd->ndisks = 0;
|
|
|
fbe740 |
|
|
|
fbe740 |
- if (!(stats = virHashCreate(10, virHashValueFree)))
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
-
|
|
|
fbe740 |
if (qemuDomainObjEnterMonitorAsync(driver, vm, priv->job.asyncJob) < 0)
|
|
|
fbe740 |
goto cleanup;
|
|
|
fbe740 |
rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false);
|
|
|
fbe740 |
@@ -496,7 +493,6 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
|
|
fbe740 |
|
|
|
fbe740 |
ret = 0;
|
|
|
fbe740 |
cleanup:
|
|
|
fbe740 |
- virHashFree(stats);
|
|
|
fbe740 |
return ret;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.25.0
|
|
|
fbe740 |
|