diff options
| author | Tanushree Shah <tshah@linux.ibm.com> | 2026-06-04 12:25:19 +0530 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2026-07-07 23:04:21 -0700 |
| commit | dcb87c88952046ef43cb5ba3a5b95eb29c362a16 (patch) | |
| tree | b96d55a92149a6dc1bade695766355e414540ab8 /scripts/Makefile.thinlto | |
| parent | f94563fac26912ef5a51fd16ae1d83f17b24b19d (diff) | |
perf data convert json: Fix trace_seq memory leak in process_sample_event()
Unlike the in-kernel trace_seq which uses a statically allocated buffer,
the userspace traceevent library's trace_seq uses a dynamically allocated
one. Therefore, every trace_seq_init() call must be paired with a
trace_seq_destroy(), otherwise it produces a memory leak.
In process_sample_event(), a trace_seq is initialized for each field when
formatting tracepoint raw_data, but the matching trace_seq_destroy() is
never called, leaking memory for every field of every sample processed.
Add the missing trace_seq_destroy() after using the trace_seq buffer to
properly free the allocated memory.
Detected with Valgrind on a perf.data file with 2,729 tracepoint samples:
Before: definitely lost: 55,537,664 bytes in 13,559 blocks
After: definitely lost: 0 bytes in 0 blocks
Fixes: 9d895e468429 ("perf data: Add tracepoint fields when converting to JSON")
Signed-off-by: Tanushree Shah <tshah@linux.ibm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
