linux-stable/scripts/kconfig
Masahiro Yamada 3f96ff44bb kconfig: fix memory leak when EOF is encountered in quotation
[ Upstream commit fbac5977d8 ]

An unterminated string literal followed by new line is passed to the
parser (with "multi-line strings not supported" warning shown), then
handled properly there.

On the other hand, an unterminated string literal at end of file is
never passed to the parser, then results in memory leak.

[Test Code]

  ----------(Kconfig begin)----------
  source "Kconfig.inc"

  config A
          bool "a"
  -----------(Kconfig end)-----------

  --------(Kconfig.inc begin)--------
  config B
          bool "b\No new line at end of file
  ---------(Kconfig.inc end)---------

[Summary from Valgrind]

  Before the fix:

    LEAK SUMMARY:
       definitely lost: 16 bytes in 1 blocks
       ...

  After the fix:

    LEAK SUMMARY:
       definitely lost: 0 bytes in 0 blocks
       ...

Eliminate the memory leak path by handling this case. Of course, such
a Kconfig file is wrong already, so I will add an error message later.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-01-26 09:37:04 +01:00
..
lxdialog License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
.gitignore Remove gperf usage from toolchain 2017-08-19 11:02:53 -07:00
check.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
conf.c kconfig: allow kconfig to handle longer path names 2015-12-10 11:06:10 +01:00
confdata.c kconfig: Avoid format overflow warning from GCC 8.1 2018-06-11 22:49:18 +02:00
expr.c kconfig: Fix expr_free() E_NOT leak 2018-04-26 11:02:08 +02:00
expr.h Kconfig: Introduce the "imply" keyword 2016-11-16 09:26:33 +01:00
gconf.c gconfig: remove misleading parentheses around a condition 2017-03-22 02:56:33 +09:00
gconf.glade scripts/kconfig/gconf.glade Update broken web addresses. 2010-09-17 16:54:42 +02:00
images.c
kconf_id.c Remove gperf usage from toolchain 2017-08-19 11:02:53 -07:00
kxgettext.c kconfig: nuke LKC_DIRECT_LINK cruft 2011-06-06 15:32:20 -04:00
list.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
lkc.h Remove gperf usage from toolchain 2017-08-19 11:02:53 -07:00
lkc_proto.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mconf.c kconfig: Do not print status messages in make -s mode 2015-04-09 17:44:34 +02:00
menu.c kconfig: Fix automatic menu creation mem leak 2018-04-26 11:02:08 +02:00
merge_config.sh kconfig/merge_config.sh: Accept a single file 2015-10-14 16:19:37 +02:00
nconf.c kconfig: fix sparse warnings in nconfig 2017-06-23 06:00:52 +09:00
nconf.gui.c kconfig: fix sparse warnings in nconfig 2017-06-23 06:00:52 +09:00
nconf.h scripts/kconfig/nconf: dynamically alloc dialog_input_result 2011-09-09 14:40:08 +02:00
POTFILES.in
qconf.cc xconfig: fix missing suboption and help panels on first run 2016-12-11 21:40:54 +01:00
qconf.h Port xconfig to Qt5 - Source format. 2015-10-14 14:59:03 +02:00
streamline_config.pl scripts: Switch to more portable Perl shebang 2017-05-14 11:20:44 +09:00
symbol.c Kconfig: Introduce the "imply" keyword 2016-11-16 09:26:33 +01:00
util.c kconfig: Remove dead code 2015-02-25 15:00:16 +01:00
zconf.l kconfig: fix memory leak when EOF is encountered in quotation 2019-01-26 09:37:04 +01:00
zconf.lex.c_shipped kconfig: Regenerate shipped zconf.{hash,lex}.c files 2015-08-19 17:05:39 +02:00
zconf.tab.c_shipped Remove gperf usage from toolchain 2017-08-19 11:02:53 -07:00
zconf.y kconfig: fix the rule of mainmenu_stmt symbol 2018-11-04 14:52:45 +01:00