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