Re: [PATCH] perf trace: guard free(new_filter) to avoid double-free on OOM
From: Namhyung Kim
Date: Thu Nov 19 2026 - 22:54:16 EST
On Thu, 12 Nov 2026 11:18:09 +0800, Gu Bin wrote:
> On the asprintf() failure path in trace__expand_filter(), free(new_filter)
> is called unconditionally. On the first iteration new_filter aliases
> evsel->filter, so this frees the evsel's own filter string; when the
> error propagates and the evsel is later deleted, evsel->filter is freed
> a second time.
>
> The success path, right below, guards the free with
> "if (new_filter != evsel->filter)". Do the same on the error path.
>
> [...]
Applied to perf-tools-next, thanks!
Best regards
Namhyung