]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: authconfig: Don't check return value of 'g_key_file_new()'
authorPeter Krempa <pkrempa@redhat.com>
Mon, 23 Jan 2023 15:36:43 +0000 (16:36 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 24 Jan 2023 12:10:31 +0000 (13:10 +0100)
The function can't fail so it's pointless to check its return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virauthconfig.c

index 0363a1bef92ba97f3fef9982eeb08583d8aa88e5..818df7a25281895b50d669509649afff299b3fd8 100644 (file)
@@ -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;