linux-stable/scripts/kconfig
Masahiro Yamada 19f67233d1 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 17:42:15 +01:00
..
lxdialog kconfig/[mn]conf: handle backspace (^H) key 2019-05-04 09:20:22 +02:00
tests
.gitignore
conf.c
confdata.c kconfig: fix broken dependency in randconfig-generated .config 2020-02-24 08:34:39 +01:00
expr.c kconfig: don't crash on NULL expressions in expr_eq() 2020-01-12 12:17:19 +01:00
expr.h kconfig: fix missing choice values in auto.conf 2019-07-26 09:14:24 +02: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
gconf.glade
images.c
kconf_id.c
list.h
lkc.h
lkc_proto.h
Makefile kconfig: do not require pkg-config on make {menu,n}config 2018-09-03 02:13:48 +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
menu.c
merge_config.sh
nconf-cfg.sh kconfig: do not require pkg-config on make {menu,n}config 2018-09-03 02:13:48 +09:00
nconf.c kconfig: nconf: stop endless search loops 2021-05-22 10:59:41 +02:00
nconf.gui.c kconfig/[mn]conf: handle backspace (^H) key 2019-05-04 09:20:22 +02:00
nconf.h
preprocess.c kconfig: fix possible buffer overflow 2023-09-23 10:48:12 +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:31:04 +02:00
qconf.h
streamline_config.pl
symbol.c kconfig: fix memory leak from range properties 2023-12-13 17:42:15 +01:00
util.c
zconf.l kconfig: fix memory leak when EOF is encountered in quotation 2019-01-26 09:32:39 +01:00
zconf.y