kconfig: Don't leak choice names during parsing
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 20 Feb 2018 11:40:29 +0000 (20:40 +0900)
committerChristian Lamparter <chunkeey@gmail.com>
Sun, 10 Feb 2019 20:59:31 +0000 (21:59 +0100)
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").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
config/zconf.y

index 250d58e7d046a244fd195ea546f48fabdb8ba01e..c292f27d41d883a707b533bc9c7e5556e81cd8d2 100644 (file)
@@ -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());
 };