kernel_samsung_a53x/scripts/kconfig
Masahiro Yamada d63942ce3e kconfig: fix memory leak from range properties
[ Upstream commit ae1eff0349f2e908fc083630e8441ea6dc434dc0 ]

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>
2024-11-18 12:11:26 +01:00
..
lxdialog Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tests Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
conf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
confdata.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
expr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
expr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gconf-cfg.sh Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gconf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gconf.glade Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
images.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
images.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lexer.l Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
list.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lkc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lkc_proto.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mconf-cfg.sh Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mconf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
menu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
merge_config.sh Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nconf-cfg.sh Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nconf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nconf.gui.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nconf.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
parser.y Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
preprocess.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qconf-cfg.sh Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qconf.cc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qconf.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
streamline_config.pl Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
symbol.c kconfig: fix memory leak from range properties 2024-11-18 12:11:26 +01:00
util.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00