[PATCH 1/5] util: authconfig: Don't check return value of 'g_key_file_new()'

Peter Krempa pkrempa at redhat.com
Mon Jan 23 16:08:51 UTC 2023


The function can't fail so it's pointless to check its return value.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/virauthconfig.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c
index 0363a1bef9..818df7a252 100644
--- a/src/util/virauthconfig.c
+++ b/src/util/virauthconfig.c
@@ -41,9 +41,7 @@ virAuthConfigNew(const char *path)
     g_autoptr(virAuthConfig) auth = g_new0(virAuthConfig, 1);

     auth->path = g_strdup(path);
-
-    if (!(auth->keyfile = g_key_file_new()))
-        return NULL;
+    auth->keyfile = g_key_file_new();

     if (!g_key_file_load_from_file(auth->keyfile, path, 0, NULL))
         return NULL;
@@ -60,9 +58,7 @@ virAuthConfigNewData(const char *path,
     g_autoptr(virAuthConfig) auth = g_new0(virAuthConfig, 1);

     auth->path = g_strdup(path);
-
-    if (!(auth->keyfile = g_key_file_new()))
-        return NULL;
+    auth->keyfile = g_key_file_new();

     if (!g_key_file_load_from_data(auth->keyfile, data, len, 0, NULL))
         return NULL;
-- 
2.38.1



More information about the libvir-list mailing list