Skip to content

Commit

Permalink
src/manifest: fix manifest leaking on error in parse_manifest()
Browse files Browse the repository at this point in the history
Fixes coverity issue:
| CID 1445506 (#1 of 1): Resource leak (RESOURCE_LEAK)
| 7. leaked_storage: Variable raucm going out of scope leaks the storage it points to

Signed-off-by: Enrico Joerns <[email protected]>
  • Loading branch information
ejoerns committed Mar 1, 2022
1 parent f6131f0 commit 45a51f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static gboolean parse_image(GKeyFile *key_file, const gchar *group, RaucImage **
static gboolean parse_manifest(GKeyFile *key_file, RaucManifest **manifest, GError **error)
{
GError *ierror = NULL;
RaucManifest *raucm = g_new0(RaucManifest, 1);
g_autoptr(RaucManifest) raucm = NULL;
gboolean res = FALSE;
g_autofree gchar *tmp = NULL;
g_auto(GStrv) groups = NULL;
Expand All @@ -114,6 +114,8 @@ static gboolean parse_manifest(GKeyFile *key_file, RaucManifest **manifest, GErr

g_assert_null(*manifest);

raucm = g_new0(RaucManifest, 1);

/* parse [update] section */
raucm->update_compatible = key_file_consume_string(key_file, "update", "compatible", &ierror);
if (!raucm->update_compatible) {
Expand Down

0 comments on commit 45a51f7

Please sign in to comment.