Re: [PATH v2] bpftool: Fix memory leak in dump_xx_nlmsg on realloc failure

From: Alexei Starovoitov
Date: Thu Jun 19 2025 - 11:55:52 EST


On Wed, Jun 18, 2025 at 11:57 PM chenyuan <chenyuan_fl@xxxxxxx> wrote:
>
> From: chenyuan <chenyuan@xxxxxxxxxx>
>
> 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.
>
> Fix: 7900efc19214 ("tools/bpf: bpftool: improve output format for bpftool net")
> Signed-off-by: chenyuan <chenyuan@xxxxxxxxxx>

SOB and Author field should have full name as "First Last".

pw-bot: cr