Re: [PATCH v2] tools/lib/api: Fix potential double-free from fdarray__grow()

From: Namhyung Kim

Date: Thu Jul 16 2026 - 13:27:40 EST


On Fri, 10 Jul 2026 17:32:35 -0700, Namhyung Kim wrote:
> If the realloc for fda->entries succeeds but the realloc for fda->priv
> fails, the error path frees the newly allocated entries.
>
> However, fda->entries is neither updated to point to the new entries block
> nor cleared to NULL. If realloc moved the allocation to a new block, the
> old fda->entries pointer is now freed memory.
>
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung