LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf data convert json: Fix addr_location leak on time-filtered samples
@ 2026-06-06 12:15 Tanushree Shah
  2026-06-06 15:47 ` Ian Rogers
  0 siblings, 1 reply; 2+ messages in thread
From: Tanushree Shah @ 2026-06-06 12:15 UTC (permalink / raw)
  To: acme, jolsa, adrian.hunter, vmolnaro, mpetlan, tmricht, maddy,
	irogers, namhyung
  Cc: linux-perf-users, linuxppc-dev, atrajeev, hbathini, Tejas.Manhas1,
	Tanushree.Shah, Shivani.Nittor, Tanushree Shah

When samples are skipped due to time filtering in process_sample_event(),
the early return path bypasses addr_location__exit(), causing memory leaks
of thread, map, and maps references acquired by machine__resolve().

These references must be released through addr_location__exit() before
returning.

Fixes: 8e746e95c3e4 ("perf data: Allow filtering conversion by time range")
Signed-off-by: Tanushree Shah <tshah@linux.ibm.com>
---
 tools/perf/util/data-convert-json.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-convert-json.c
index d526c91312ed..6a8d00c80394 100644
--- a/tools/perf/util/data-convert-json.c
+++ b/tools/perf/util/data-convert-json.c
@@ -177,6 +177,7 @@ static int process_sample_event(const struct perf_tool *tool,
 
 	if (perf_time__ranges_skip_sample(c->ptime_range, c->range_num, sample->time)) {
 		++c->skipped;
+		addr_location__exit(&al);
 		return 0;
 	}
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf data convert json: Fix addr_location leak on time-filtered samples
  2026-06-06 12:15 [PATCH] perf data convert json: Fix addr_location leak on time-filtered samples Tanushree Shah
@ 2026-06-06 15:47 ` Ian Rogers
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Rogers @ 2026-06-06 15:47 UTC (permalink / raw)
  To: Tanushree Shah
  Cc: acme, jolsa, adrian.hunter, vmolnaro, mpetlan, tmricht, maddy,
	namhyung, linux-perf-users, linuxppc-dev, atrajeev, hbathini,
	Tejas.Manhas1, Tanushree.Shah, Shivani.Nittor

On Sat, Jun 6, 2026 at 5:20 AM Tanushree Shah <tshah@linux.ibm.com> wrote:
>
> When samples are skipped due to time filtering in process_sample_event(),
> the early return path bypasses addr_location__exit(), causing memory leaks
> of thread, map, and maps references acquired by machine__resolve().
>
> These references must be released through addr_location__exit() before
> returning.
>
> Fixes: 8e746e95c3e4 ("perf data: Allow filtering conversion by time range")
> Signed-off-by: Tanushree Shah <tshah@linux.ibm.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/util/data-convert-json.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-convert-json.c
> index d526c91312ed..6a8d00c80394 100644
> --- a/tools/perf/util/data-convert-json.c
> +++ b/tools/perf/util/data-convert-json.c
> @@ -177,6 +177,7 @@ static int process_sample_event(const struct perf_tool *tool,
>
>         if (perf_time__ranges_skip_sample(c->ptime_range, c->range_num, sample->time)) {
>                 ++c->skipped;
> +               addr_location__exit(&al);
>                 return 0;
>         }
>
> --
> 2.47.3
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-06 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-06 12:15 [PATCH] perf data convert json: Fix addr_location leak on time-filtered samples Tanushree Shah
2026-06-06 15:47 ` Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox