* [PATCH] kconfig: fix memory leak in sym_warn_unmet_dep()
@ 2025-01-20 8:10 Masahiro Yamada
2025-01-20 18:50 ` Petr Vorel
0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2025-01-20 8:10 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada, Petr Vorel
The string allocated in sym_warn_unmet_dep() is never freed, leading
to a memory leak when an unmet dependency is detected.
Fixes: f8f69dc0b4e0 ("kconfig: make unmet dependency warnings readable")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/symbol.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 89b84bf8e21f..1521cdf62fce 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -389,6 +389,7 @@ static void sym_warn_unmet_dep(const struct symbol *sym)
fputs(str_get(&gs), stderr);
sym_warnings++;
+ str_free(&gs);
}
bool sym_dep_errors(void)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] kconfig: fix memory leak in sym_warn_unmet_dep()
2025-01-20 8:10 [PATCH] kconfig: fix memory leak in sym_warn_unmet_dep() Masahiro Yamada
@ 2025-01-20 18:50 ` Petr Vorel
0 siblings, 0 replies; 2+ messages in thread
From: Petr Vorel @ 2025-01-20 18:50 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel
Hi Masahiro,
> The string allocated in sym_warn_unmet_dep() is never freed, leading
> to a memory leak when an unmet dependency is detected.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
+1
I looked at other str_new() uses, but all looks to be using str_free()
(or return a pointer, which is freed by the caller).
Kind regards,
Petr
> Fixes: f8f69dc0b4e0 ("kconfig: make unmet dependency warnings readable")
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> scripts/kconfig/symbol.c | 1 +
> 1 file changed, 1 insertion(+)
> diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
> index 89b84bf8e21f..1521cdf62fce 100644
> --- a/scripts/kconfig/symbol.c
> +++ b/scripts/kconfig/symbol.c
> @@ -389,6 +389,7 @@ static void sym_warn_unmet_dep(const struct symbol *sym)
> fputs(str_get(&gs), stderr);
> sym_warnings++;
> + str_free(&gs);
> }
> bool sym_dep_errors(void)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-20 18:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-20 8:10 [PATCH] kconfig: fix memory leak in sym_warn_unmet_dep() Masahiro Yamada
2025-01-20 18:50 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox