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)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 2 Mar 2018 00:20:55 +0000 (09:20 +0900)
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>
scripts/kconfig/zconf.y

index f5cb55f03ce59b9c8e65abeb5fee814a11cf22fc..ad6305b0f40cb962edf922ae73639c75b63c60c0 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());
 };