[PATCH RFT 9/9] common: bootargs: don't leave linux_bootargs dangling after free
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Aug 26 05:17:13 PDT 2026
linux_bootargs_get() frees the cached command line before recomputing it,
but the early return taken when there are no bootargs leaves the static
pointer referencing the freed allocation, so the next call frees it a
second time.
Clear the pointer right after freeing it.
Fixes: ee4cab9e5874 ("booting: more flexible Linux bootargs generation")
Assisted-by: Claude:opus-5
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
common/bootargs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/bootargs.c b/common/bootargs.c
index 710f74de9629..91e92e594876 100644
--- a/common/bootargs.c
+++ b/common/bootargs.c
@@ -30,6 +30,7 @@ const char *linux_bootargs_get(void)
return linux_bootargs;
free(linux_bootargs);
+ linux_bootargs = NULL;
bootargs = globalvar_get_match("linux.bootargs.", " ");
if (!*bootargs) {
--
2.47.3
More information about the barebox
mailing list