From 72df5f67527a63c6c1546f7944dfb0df24685e3e Mon Sep 17 00:00:00 2001 From: Adrian Bonislawski Date: Thu, 19 Dec 2024 11:12:28 +0100 Subject: [PATCH] rimage: fix resource leak in err handling Fix resource leak in man_module_create_reloc Signed-off-by: Adrian Bonislawski --- tools/rimage/src/manifest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/rimage/src/manifest.c b/tools/rimage/src/manifest.c index 007a59e8fcd2..b641c177d124 100644 --- a/tools/rimage/src/manifest.c +++ b/tools/rimage/src/manifest.c @@ -502,6 +502,7 @@ static int man_module_create_reloc(struct image *image, struct manifest_module * if (!n_mod || n_mod * sizeof(*sof_mod) != section.header.data.size) { fprintf(stderr, "error: Invalid module manifests in '.module' section.\n"); + elf_section_free(§ion); return -ENOEXEC; } @@ -532,6 +533,7 @@ static int man_module_create_reloc(struct image *image, struct manifest_module * if (j == image->adsp->modules->mod_man_count) { fprintf(stderr, "error: cannot find %s in manifest.\n", name); + elf_section_free(§ion); return -ENOEXEC; } }