Files
Namhyung Kim eadce0f46a tools/lib/api: Fix potential double-free from fdarray__grow()
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.

When fdarray__exit() is later called to clean up, it executes
free(fda->entries), which would trigger a double-free on that old pointer.

Reported-by: Sashiko Review <[email protected]>
Closes: https://lore.kernel.org/linux-perf-users/[email protected]
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
2026-07-16 09:56:47 -07:00
..
…