[libvirt PATCH 05/10] iptablesPrivateChainCreate: `virHashNew` cannot return NULL

Tim Wiederhake twiederh at redhat.com
Fri Jul 9 08:27:34 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/util/viriptables.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/util/viriptables.c b/src/util/viriptables.c
index 4189578245..198ece3d71 100644
--- a/src/util/viriptables.c
+++ b/src/util/viriptables.c
@@ -70,17 +70,12 @@ iptablesPrivateChainCreate(virFirewall *fw,
                            void *opaque)
 {
     iptablesGlobalChainData *data = opaque;
-    GHashTable *chains = NULL;
-    GHashTable *links = NULL;
+    GHashTable *chains = virHashNew(NULL);
+    GHashTable *links = virHashNew(NULL);
     const char *const *tmp;
     int ret = -1;
     size_t i;
 
-    if (!(chains = virHashNew(NULL)))
-        goto cleanup;
-    if (!(links = virHashNew(NULL)))
-        goto cleanup;
-
     tmp = lines;
     while (tmp && *tmp) {
         if (STRPREFIX(*tmp, "-N ")) { /* eg "-N LIBVIRT_INP" */
-- 
2.31.1




More information about the libvir-list mailing list