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

John Ferlan posted 9 patches 4 years, 5 months ago
[PATCH 2/9] util: Fix memory leak in virAuthConfigLookup
Posted by John Ferlan 4 years, 5 months ago
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>
---
 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