]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Fix memory leak in virAuthConfigLookup
authorJohn Ferlan <jferlan@redhat.com>
Tue, 16 Jun 2020 12:07:03 +0000 (08:07 -0400)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 16 Jun 2020 13:01:05 +0000 (15:01 +0200)
Since 5084091a, @authcred is filled by a g_key_file_get_string which is
now an allocated string as opposed to some hash table lookup value, so
we need to treat it as so.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/util/virauthconfig.c

index 8289b28d348e5f1b94c5f1ff8e24e0a18e7f0999..2e50609531edae13211971cef4c285e20b903e57 100644 (file)
@@ -103,7 +103,7 @@ int virAuthConfigLookup(virAuthConfigPtr auth,
 {
     g_autofree char *authgroup = NULL;
     g_autofree char *credgroup = NULL;
-    const char *authcred;
+    g_autofree char *authcred = NULL;
 
     *value = NULL;