[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFkk2KRbErqLGspp9Th9J+nGzJffxpmiZ81b6jqe-dNH9SJ3ig@mail.gmail.com>
Date: Tue, 20 Feb 2018 20:54:58 +0100
From: Ulf Magnusson <ulfalizer@...il.com>
To: Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc: Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Sam Ravnborg <sam@...nborg.org>,
Michal Marek <michal.lkml@...kovi.net>,
Randy Dunlap <rdunlap@...radead.org>,
"Luis R. Rodriguez" <mcgrof@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kconfig: Don't leak choice names during parsing
On Tue, Feb 20, 2018 at 12:40 PM, Masahiro Yamada
<yamada.masahiro@...ionext.com> wrote:
> The named choice is not used in the kernel tree, but if it were used,
> it would not be freed.
>
> The intention of the named choice can be seen in the log of
> commit 5a1aa8a1aff6 ("kconfig: add named choice group").
>
> There is room for argument if this is useful in practice, but anyway
> I am fixing the memory leak.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>
> ---
>
> scripts/kconfig/zconf.y | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
> index 4be9805..4893676 100644
> --- a/scripts/kconfig/zconf.y
> +++ b/scripts/kconfig/zconf.y
> @@ -276,6 +276,7 @@ choice: T_CHOICE word_opt T_EOL
> sym->flags |= SYMBOL_AUTO;
> menu_add_entry(sym);
> menu_add_expr(P_CHOICE, NULL, NULL);
> + free($2);
> printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
> };
>
> --
> 2.7.4
>
Reviewed-by: Ulf Magnusson <ulfalizer@...il.com>
Only place I've seen named choices in practice is in the esp-idf
project. Not sure what they're using them for.
They were handy for writing tests too. :P
Cheers,
Ulf
Powered by blists - more mailing lists