a41c76
From ca7c7a8b07c31dc8bf96f7da6fb53af884e36ddb Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <ca7c7a8b07c31dc8bf96f7da6fb53af884e36ddb@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 4 Feb 2020 15:08:01 +0100
a41c76
Subject: [PATCH] Remove checking of return value of virHashNew
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
There are two calls to virHashNew which check the return value. It's not
a41c76
necessary any more as virHashNew always returns a valid pointer.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
a41c76
(cherry picked from commit 6eab924daa243afa67f2cc20dcbdf521904bb62b)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1793263
a41c76
Message-Id: <08acb2e50b584a75c0131a628ee441f47e8fe823.1580824112.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/conf/backup_conf.c       | 6 +-----
a41c76
 src/qemu/qemu_monitor_json.c | 3 +--
a41c76
 2 files changed, 2 insertions(+), 7 deletions(-)
a41c76
a41c76
diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
a41c76
index b370b686f1..64c8f6cc09 100644
a41c76
--- a/src/conf/backup_conf.c
a41c76
+++ b/src/conf/backup_conf.c
a41c76
@@ -439,15 +439,11 @@ virDomainBackupAlignDisks(virDomainBackupDefPtr def,
a41c76
                           virDomainDefPtr dom,
a41c76
                           const char *suffix)
a41c76
 {
a41c76
-    g_autoptr(virHashTable) disks = NULL;
a41c76
+    g_autoptr(virHashTable) disks = virHashNew(NULL);
a41c76
     size_t i;
a41c76
     int ndisks;
a41c76
     bool backup_all = false;
a41c76
 
a41c76
-
a41c76
-    if (!(disks = virHashNew(NULL)))
a41c76
-        return -1;
a41c76
-
a41c76
     /* Unlikely to have a guest without disks but technically possible.  */
a41c76
     if (!dom->ndisks) {
a41c76
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
a41c76
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
a41c76
index 5d8c7e9b5e..3fc0bcb80c 100644
a41c76
--- a/src/qemu/qemu_monitor_json.c
a41c76
+++ b/src/qemu/qemu_monitor_json.c
a41c76
@@ -2992,8 +2992,7 @@ qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValuePtr nodes)
a41c76
 {
a41c76
     g_autoptr(virHashTable) ret = NULL;
a41c76
 
a41c76
-    if (!(ret = virHashNew((virHashDataFree) qemuMonitorJSONBlockNamedNodeDataFree)))
a41c76
-        return NULL;
a41c76
+    ret = virHashNew((virHashDataFree) qemuMonitorJSONBlockNamedNodeDataFree);
a41c76
 
a41c76
     if (virJSONValueArrayForeachSteal(nodes,
a41c76
                                       qemuMonitorJSONBlockGetNamedNodeDataWorker,
a41c76
-- 
a41c76
2.25.0
a41c76