From: Anton Moryakov <ant.v.morya...@gmail.com>

- Added buffer_delete(&manifest) before returning COMMAND_ERR.
- Prevents memory leak when file loading fails.

Signed-off-by: Anton Moryakov <ant.v.morya...@gmail.com>

---
 tools/ifwitool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/ifwitool.c b/tools/ifwitool.c
index 762161d769e..c17087963cd 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");
-- 
2.30.2

Reply via email to