Skip to content

Commit

Permalink
src/manifest: fix freeing of groups in parse_manifest()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ejoerns committed Mar 2, 2022
1 parent 8667b1b commit 8be8c43
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8be8c43

Please sign in to comment.