From cbf8f467920cd31d826d4b9dff89b25345384f31 Mon Sep 17 00:00:00 2001 From: Enrico Joerns Date: Tue, 1 Mar 2022 20:42:23 +0100 Subject: [PATCH] src/manifest: fix freeing of groups in parse_manifest() The char pointer array 'groups' is freed manually with g_strfreev. It is not freed in case of an error and a jump to the 'free:' label. Fixes coverity issue: | CID 1445510 (#1 of 1): Resource leak (RESOURCE_LEAK) | 17. leaked_storage: Variable groups going out of scope leaks the storage it points to Signed-off-by: Enrico Joerns --- src/manifest.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/manifest.c b/src/manifest.c index 7bb2a110e..2cc5d265a 100644 --- a/src/manifest.c +++ b/src/manifest.c @@ -107,7 +107,7 @@ static gboolean parse_manifest(GKeyFile *key_file, RaucManifest **manifest, GErr RaucManifest *raucm = g_new0(RaucManifest, 1); gboolean res = FALSE; g_autofree gchar *tmp = NULL; - gchar **groups; + g_auto(GStrv) groups = NULL; gsize group_count; g_auto(GStrv) bundle_hooks = NULL; gsize hook_entries; @@ -201,8 +201,6 @@ static gboolean parse_manifest(GKeyFile *key_file, RaucManifest **manifest, GErr goto free; } - g_strfreev(groups); - res = TRUE; *manifest = g_steal_pointer(&raucm); free: