]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpftool: Fix JSON writer resource leak in version command
authorYuan Chen <chenyuan@kylinos.cn>
Tue, 17 Jun 2025 13:24:42 +0000 (09:24 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:28:24 +0000 (16:28 +0200)
commit868b52651f69b20e5d80dab1869a0b7d78c84a56
tree3a3dcf9471ab2380749a41d9e8049e70ff9f657a
parentd930e738c0a833e9bc42386c2836ebc012bd7dd9
bpftool: Fix JSON writer resource leak in version command

[ Upstream commit 85cd83fed8267cde0dd1cea719808aad95ae4de7 ]

When using `bpftool --version -j/-p`, the JSON writer object
created in do_version() was not properly destroyed after use.
This caused a memory leak each time the version command was
executed with JSON output.

Fix: 004b45c0e51a (tools: bpftool: provide JSON output for all possible commands)

Suggested-by: Quentin Monnet <qmo@kernel.org>
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/bpf/20250617132442.9998-1-chenyuan_fl@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/bpf/bpftool/main.c