sumversion: Fix a memory leak in get_src_version()
authorElena Salomatkina <esalomatkina@ispras.ru>
Tue, 22 Oct 2024 21:37:08 +0000 (00:37 +0300)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 23 Oct 2024 07:11:13 +0000 (16:11 +0900)
commit4b60a5655528786bf659e9627fb0b45900f4cc66
tree3ee7420598fa664b4b1635cdc7f3effab10ab2c4
parent42f7652d3eb527d03665b09edac47f85fb600924
sumversion: Fix a memory leak in get_src_version()

strsep() modifies its first argument - buf.
An invalid pointer will be passed to the free() function.
Make the pointer passed to free() match the return value of
read_text_file().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 9413e7640564 ("kbuild: split the second line of *.mod into *.usyms")
Signed-off-by: Elena Salomatkina <esalomatkina@ispras.ru>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/mod/sumversion.c