perf data convert json: Fix addr_location leak on time-filtered samples
PATCH 1/1 perf data convert json: Fix addr_location leak on time-filtered samples
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.
--- tools/perf/util/data-convert-json.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/data-convert-json.c +1 -0
@@ -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 ; }
Signature · 1 line
2.47.3
Quoted 10 lines · Tanushree Shah
When samples are skipped due to time filtering in
process_sample_event(), the early return path bypassesaddr_location__exit(), causing memory leaks of thread, map, and maps references acquired bymachine__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 <[email protected]>
Thanks,
Ian
Quoted 19 lines
--- tools/perf/util/data-convert-json.c | 1 + 1 file changed, 1 insertion(+)tools/perf/util/data-convert-json.c +1
-1@@ -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
Quoted 6 lines · Ian Rogers
Quoted 5 lines · Tanushree Shah
When samples are skipped due to time filtering in
process_sample_event(), the early return path bypassesaddr_location__exit(), causing memory leaks of thread, map, and maps references acquired bymachine__resolve().
Quoted 7 lines
Quoted 5 lines
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 <[email protected]>Reviewed-by Ian Rogers <[email protected]>
Thanks, applied to perf-tools-next, for v7.2.
- Arnaldo