Commit f613ca79 authored by Yuan Chen's avatar Yuan Chen Committed by Greg Kroah-Hartman
Browse files

bpftool: Fix memory leak in dump_xx_nlmsg on realloc failure



[ Upstream commit 99fe8af0 ]

In function dump_xx_nlmsg(), when realloc() fails to allocate memory,
the original pointer to the buffer is overwritten with NULL. This causes
a memory leak because the previously allocated buffer becomes unreachable
without being freed.

Fixes: 7900efc1 ("tools/bpf: bpftool: improve output format for bpftool net")
Signed-off-by: default avatarYuan Chen <chenyuan@kylinos.cn>
Reviewed-by: default avatarQuentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/r/20250620012133.14819-1-chenyuan_fl@163.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 849d24dc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment