linux-stable/scripts/kconfig
Masahiro Yamada d162a5e6a5 kconfig: fix memory leak from range properties
[ Upstream commit ae1eff0349 ]

Currently, sym_validate_range() duplicates the range string using
xstrdup(), which is overwritten by a subsequent sym_calc_value() call.
It results in a memory leak.

Instead, only the pointer should be copied.

Below is a test case, with a summary from Valgrind.

[Test Kconfig]

  config FOO
          int "foo"
          range 10 20

[Test .config]

  CONFIG_FOO=0

[Before]

  LEAK SUMMARY:
     definitely lost: 3 bytes in 1 blocks
     indirectly lost: 0 bytes in 0 blocks
       possibly lost: 0 bytes in 0 blocks
     still reachable: 17,465 bytes in 21 blocks
          suppressed: 0 bytes in 0 blocks

[After]

  LEAK SUMMARY:
     definitely lost: 0 bytes in 0 blocks
     indirectly lost: 0 bytes in 0 blocks
       possibly lost: 0 bytes in 0 blocks
     still reachable: 17,462 bytes in 20 blocks
          suppressed: 0 bytes in 0 blocks

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-13 18:18:10 +01:00
..
lxdialog kconfig: remove trailing whitespaces 2019-05-09 22:37:17 +09:00
tests docs: kbuild: convert docs to ReST and rename to *.rst 2019-06-14 14:21:21 -06:00
.gitignore kconfig: rename generated .*conf-cfg to *conf-cfg 2019-01-06 10:47:09 +09:00
conf.c kconfig: Fix spelling of sym_is_changable 2019-07-06 21:58:23 +09:00
confdata.c kconfig: fix failing to generate auto.conf 2022-02-23 12:00:01 +01:00
expr.c kconfig: don't crash on NULL expressions in expr_eq() 2020-01-12 12:21:35 +01:00
expr.h kconfig: fix missing choice values in auto.conf 2019-07-17 22:37:51 +09:00
gconf-cfg.sh kconfig: do not require pkg-config on make {menu,n}config 2018-09-03 02:13:48 +09:00
gconf.c kconfig: remove trailing whitespaces 2019-05-09 22:37:17 +09:00
gconf.glade
images.c kconfig: split images.c out of qconf.cc/gconf.c to fix gconf warnings 2018-12-28 22:22:39 +09:00
images.h kconfig: split images.c out of qconf.cc/gconf.c to fix gconf warnings 2018-12-28 22:22:39 +09:00
lexer.l kconfig: use snprintf for formatting pathnames 2019-05-14 23:23:25 +09:00
list.h
lkc.h kconfig: require the argument of --defconfig 2019-06-09 15:08:18 +09:00
lkc_proto.h kconfig: Fix spelling of sym_is_changable 2019-07-06 21:58:23 +09:00
Makefile kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj) 2019-09-04 23:12:50 +09:00
mconf-cfg.sh kconfig: do not require pkg-config on make {menu,n}config 2018-09-03 02:13:48 +09:00
mconf.c kconfig: Fix spelling of sym_is_changable 2019-07-06 21:58:23 +09:00
menu.c kconfig: convert to SPDX License Identifier 2018-12-28 22:22:28 +09:00
merge_config.sh merge_config.sh: ignore unwanted grep errors 2019-09-04 23:12:50 +09:00
nconf-cfg.sh kconfig: Make nconf-cfg.sh executable 2019-04-09 22:44:57 +09:00
nconf.c kconfig: nconf: stop endless search loops 2021-05-19 10:08:23 +02:00
nconf.gui.c kconfig/[mn]conf: handle backspace (^H) key 2019-03-29 22:48:01 +09:00
nconf.h kconfig: convert to SPDX License Identifier 2018-12-28 22:22:28 +09:00
parser.y kconfig: rename zconf.y to parser.y 2019-02-13 23:25:58 +09:00
preprocess.c kconfig: fix possible buffer overflow 2023-09-23 10:59:57 +02:00
qconf-cfg.sh kconfig: do not require pkg-config on make {menu,n}config 2018-09-03 02:13:48 +09:00
qconf.cc kconfig: qconf: fix signal connection to invalid slots 2020-08-26 10:41:04 +02:00
qconf.h kconfig: fix 'Save As' menu of xconfig 2019-03-12 02:50:24 +09:00
streamline_config.pl kconfig: convert to SPDX License Identifier 2018-12-28 22:22:28 +09:00
symbol.c kconfig: fix memory leak from range properties 2023-12-13 18:18:10 +01:00
util.c kconfig: convert to SPDX License Identifier 2018-12-28 22:22:28 +09:00