Re: [PATCH v2] semihosting: fix memleak at semihosting_arg_fallback

2023-10-20 Thread Alex Bennée
Matheus Tavares Bernardino writes: > We duplicate "cmd" as strtok may modify its argument, but we forgot > to free it later. Furthermore, add_semihosting_arg doesn't take > responsibility for this memory either (it strdup's the argument). > > Signed-off-by: Matheus Tavares Bernardino >

[PATCH v2] semihosting: fix memleak at semihosting_arg_fallback

2023-10-20 Thread Matheus Tavares Bernardino
We duplicate "cmd" as strtok may modify its argument, but we forgot to free it later. Furthermore, add_semihosting_arg doesn't take responsibility for this memory either (it strdup's the argument). Signed-off-by: Matheus Tavares Bernardino Reviewed-by: Philippe Mathieu-Daudé ---