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