render / rpms / libvirt

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