[PATCH] tools: ifwitool: fix memory leak in ibbp_dir_add()
Anton Moryakov
ant.v.moryakov at gmail.com
Thu May 21 21:13:59 CEST 2026
Signed-off-by: Anton Moryakov <ant.v.moryakov at gmail.com>
---
tools/ifwitool.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/ifwitool.c b/tools/ifwitool.c
index c1defe57737..77d7207eb80 100644
--- a/tools/ifwitool.c
+++ b/tools/ifwitool.c
@@ -1741,8 +1741,10 @@ static enum ifwi_ret ibbp_dir_add(int type)
init_signed_pkg_info_ext(ext, 0, subparts[type].name);
/* Entry # 2 - IBBL */
- if (buffer_from_file(&ibbl, param.file_name))
+ if (buffer_from_file(&ibbl, param.file_name)) {
+ buffer_delete(&manifest);
return COMMAND_ERR;
+ }
/* Entry # 3 - IBB */
alloc_buffer(&ibb, DUMMY_IBB_SIZE, "IBB");
@@ -1755,6 +1757,11 @@ static enum ifwi_ret ibbp_dir_add(int type)
create_subpart(&ifwi_image.subpart_buf[type], &info[0],
ARRAY_SIZE(info), subparts[type].name);
+ /* Clean up temporary buffers */
+ buffer_delete(&manifest);
+ buffer_delete(&ibbl);
+ buffer_delete(&ibb);
+
return REPACK_REQUIRED;
}
--
2.39.2
More information about the U-Boot
mailing list