From 31a9c13eabfdb3d65ffd4587a7974f8fadd11cca Mon Sep 17 00:00:00 2001 From: Enrico Joerns Date: Tue, 1 Mar 2022 22:36:38 +0100 Subject: [PATCH] src/config_file: free groups leaking on error in load_config() When jumping to free: label, g_strfreev() will not be called. Use g_autoptr() instead. Fixes coverity issue: | CID 1445489 (#1 of 1): Resource leak (RESOURCE_LEAK) | 47. leaked_storage: Variable groups going out of scope leaks the storage it points to. Signed-off-by: Enrico Joerns --- src/config_file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/config_file.c b/src/config_file.c index 9783e60be..634ced385 100644 --- a/src/config_file.c +++ b/src/config_file.c @@ -159,7 +159,7 @@ gboolean load_config(const gchar *filename, RaucConfig **config, GError **error) g_autoptr(RaucConfig) c = g_new0(RaucConfig, 1); gboolean res = FALSE; g_autoptr(GKeyFile) key_file = NULL; - gchar **groups; + g_auto(GStrv) groups = NULL; gsize group_count; GList *slotlist = NULL; GHashTable *slots = NULL; @@ -741,8 +741,6 @@ gboolean load_config(const gchar *filename, RaucConfig **config, GError **error) goto free; } - g_strfreev(groups); - res = TRUE; free: if (res)