diff options
author | Ulf Magnusson <ulfalizer@gmail.com> | 2017-10-08 20:11:20 +0300 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-01-10 19:14:01 +0300 |
commit | bc28fe1d5ede887312a329d06ac7ba1ba51d0d85 (patch) | |
tree | 37418a17415ff2637009d982fe9a59130c408200 /scripts/kconfig/zconf.y | |
parent | 24161a6711c94598fdebb0aac1301881ada47908 (diff) | |
download | linux-bc28fe1d5ede887312a329d06ac7ba1ba51d0d85.tar.xz |
kconfig: Don't leak 'option' arguments during parsing
The following strings would leak before this change:
- option env="LEAKED"
- option defconfig_list="LEAKED"
These come in the form of T_WORD tokens and are always allocated on the
heap in zconf.l. Free them.
Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
LEAK SUMMARY:
definitely lost: 344,616 bytes in 14,355 blocks
...
Summary after the fix:
LEAK SUMMARY:
definitely lost: 344,568 bytes in 14,352 blocks
...
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/kconfig/zconf.y')
-rw-r--r-- | scripts/kconfig/zconf.y | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 1c6d33bc9702..df9cb12111e4 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -236,8 +236,10 @@ symbol_option_list: | symbol_option_list T_WORD symbol_option_arg { const struct kconf_id *id = kconf_id_lookup($2, strlen($2)); - if (id && id->flags & TF_OPTION) + if (id && id->flags & TF_OPTION) { menu_add_option(id->token, $3); + free($3); + } else zconfprint("warning: ignoring unknown option %s", $2); free($2); |