diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2023-11-15 07:16:53 +0300 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2023-11-17 07:24:08 +0300 |
commit | ae1eff0349f2e908fc083630e8441ea6dc434dc0 (patch) | |
tree | eaecd0aa59fa4c44633232c88b59f408804653cb /include | |
parent | 76020731d4ee897411ce4a73916ed805ea15d946 (diff) | |
download | linux-ae1eff0349f2e908fc083630e8441ea6dc434dc0.tar.xz |
kconfig: fix memory leak from range properties
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>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions