[tip: objtool/core] objtool/klp: Fix XXH3 state memory leak

From: tip-bot2 for Josh Poimboeuf

Date: Tue May 05 2026 - 07:10:45 EST


The following commit has been merged into the objtool/core branch of tip:

Commit-ID: 479ac5260e7ea717f1ea7b1e74dfe807d3b46eda
Gitweb: https://git.kernel.org/tip/479ac5260e7ea717f1ea7b1e74dfe807d3b46eda
Author: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
AuthorDate: Thu, 02 Apr 2026 17:35:53 -07:00
Committer: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
CommitterDate: Mon, 04 May 2026 21:16:01 -07:00

objtool/klp: Fix XXH3 state memory leak

The XXH3 state allocated in checksum_init() is never freed. Free it in
checksum_finish().

Acked-by: Song Liu <song@xxxxxxxxxx>
Reviewed-by: Miroslav Benes <mbenes@xxxxxxx>
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
tools/objtool/include/objtool/checksum.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/objtool/include/objtool/checksum.h b/tools/objtool/include/objtool/checksum.h
index 7fe2160..0bd16fe 100644
--- a/tools/objtool/include/objtool/checksum.h
+++ b/tools/objtool/include/objtool/checksum.h
@@ -26,6 +26,7 @@ static inline void checksum_finish(struct symbol *func)
{
if (func && func->csum.state) {
func->csum.checksum = XXH3_64bits_digest(func->csum.state);
+ XXH3_freeState(func->csum.state);
func->csum.state = NULL;
}
}