* [PATCH] bootargs: fix memory leak
@ 2025-11-27 8:07 Sascha Hauer
2025-11-28 7:11 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2025-11-27 8:07 UTC (permalink / raw)
To: Barebox List
globalvar_get_match() returns an allocated string. Free it after usage,
even when the allocated string is empty.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/bootargs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/common/bootargs.c b/common/bootargs.c
index ad8007d32a..36528b8b58 100644
--- a/common/bootargs.c
+++ b/common/bootargs.c
@@ -34,8 +34,10 @@ const char *linux_bootargs_get(void)
free(linux_bootargs);
bootargs = globalvar_get_match("linux.bootargs.", " ");
- if (!strlen(bootargs))
+ if (!strlen(bootargs)) {
+ free(bootargs);
return getenv("bootargs");
+ }
linux_bootargs = bootargs;
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] bootargs: fix memory leak
2025-11-27 8:07 [PATCH] bootargs: fix memory leak Sascha Hauer
@ 2025-11-28 7:11 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-11-28 7:11 UTC (permalink / raw)
To: Barebox List, Sascha Hauer
On Thu, 27 Nov 2025 09:07:05 +0100, Sascha Hauer wrote:
> globalvar_get_match() returns an allocated string. Free it after usage,
> even when the allocated string is empty.
>
>
Applied, thanks!
[1/1] bootargs: fix memory leak
https://git.pengutronix.de/cgit/barebox/commit/?id=16c2f25348d9 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-28 7:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-27 8:07 [PATCH] bootargs: fix memory leak Sascha Hauer
2025-11-28 7:11 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox