Commit f21ae651 authored by Marek Vasut's avatar Marek Vasut
Browse files

mxssb: Add section to the section list early



Add the newly allocated section into the section list very early, so that
in case of a failure during command parsing, the section can be properly
deallocated with all the other sections.
Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
parent 32b5eff5
...@@ -796,6 +796,8 @@ static int sb_parse_sections(struct sb_image_ctx *ictx) ...@@ -796,6 +796,8 @@ static int sb_parse_sections(struct sb_image_ctx *ictx)
if (!head) if (!head)
head = sctx; head = sctx;
if (prev)
prev->sect = sctx;
/* /*
* The sb_insts_pos will also be modified in sb_parse_cmds()! * The sb_insts_pos will also be modified in sb_parse_cmds()!
...@@ -816,8 +818,6 @@ static int sb_parse_sections(struct sb_image_ctx *ictx) ...@@ -816,8 +818,6 @@ static int sb_parse_sections(struct sb_image_ctx *ictx)
ictx->section_count++; ictx->section_count++;
if (prev)
prev->sect = sctx;
prev = sctx; prev = sctx;
free(line); free(line);
} }
...@@ -829,8 +829,6 @@ static int sb_parse_sections(struct sb_image_ctx *ictx) ...@@ -829,8 +829,6 @@ static int sb_parse_sections(struct sb_image_ctx *ictx)
fail: fail:
if (line) if (line)
free(line); free(line);
if (sctx)
free(sctx);
while (head) { while (head) {
sctx = head; sctx = head;
c_head = head->cmd; c_head = head->cmd;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment