bpftool: Fix memory leak in dump_xx_nlmsg on realloc failure
[ Upstream commit 99fe8af069a9fa5b09140518b1364e35713a642e ] 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:Yuan Chen <chenyuan@kylinos.cn> Reviewed-by:
Quentin Monnet <qmo@kernel.org> Link: https://lore.kernel.org/r/20250620012133.14819-1-chenyuan_fl@163.com Signed-off-by:
Alexei Starovoitov <ast@kernel.org> Signed-off-by:
Sasha Levin <sashal@kernel.org>
Loading
Please register or sign in to comment