[PATCH 2/9] util: Fix memory leak in virAuthConfigLookup

John Ferlan jferlan at redhat.com
Tue Jun 16 12:07:03 UTC 2020


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 at redhat.com>
---
 src/util/virauthconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c
index 8289b28d34..2e50609531 100644
--- a/src/util/virauthconfig.c
+++ b/src/util/virauthconfig.c
@@ -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;
 
-- 
2.25.4




More information about the libvir-list mailing list