From: Simon Glass <simon.glass@canonical.com> The parse_sliteral() call allocates a string for val, but it is never freed after parsing the overlay paths. Each path is duplicated by strndup/strdup, so the original string can be freed. Save the original pointer and free it on exit and error paths. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- boot/pxe_parse.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/boot/pxe_parse.c b/boot/pxe_parse.c index e5af05d4120..f6b7887f603 100644 --- a/boot/pxe_parse.c +++ b/boot/pxe_parse.c @@ -317,12 +317,13 @@ static int parse_sliteral(char **c, char **dst) */ static int parse_fdtoverlays(char **c, struct alist *overlays) { - char *val; + char *val, *start; int err; err = parse_sliteral(c, &val); if (err < 0) return err; + start = val; while (*val) { struct pxe_fdtoverlay item; @@ -348,10 +349,13 @@ static int parse_fdtoverlays(char **c, struct alist *overlays) if (!item.path || !alist_add(overlays, item)) { free(item.path); + free(start); return -ENOMEM; } } + free(start); + return 1; } -- 2.43.0