]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf data convert json: Fix addr_location leak on time-filtered samples
authorTanushree Shah <tshah@linux.ibm.com>
Sat, 6 Jun 2026 12:15:29 +0000 (17:45 +0530)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 10 Jun 2026 20:05:48 +0000 (17:05 -0300)
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: 8e746e95c3e4eb56 ("perf data: Allow filtering conversion by time range")
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Tanushree Shah <tshah@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Derek Foreman <derek.foreman@collabora.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Shivani.Nittor@ibm.com
Cc: Tanushree.Shah@ibm.com
Cc: Tejas.Manhas1@ibm.com
Cc: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/data-convert-json.c

index c71dfb77c697b51200f786e98893c66aacc3b63e..40412c3dbdb25c4b513ccff7418101b6524e036d 100644 (file)
@@ -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;
        }