Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Fix a memory leak in perf event handling
This patch is to fix the following memory leak. $ uftrace record t-abc $ uftrace report -t 3us --no-pager Total time Self time Calls Function ========== ========== ========== ==================== 4.163 us 1.000 us 1 main 3.163 us 3.163 us 1 a ================================================================= ==78057==ERROR: LeakSanitizer: detected memory leaks Direct leak of 6 byte(s) in 1 object(s) allocated from: #0 0x7f6c4cf5734f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6234f) #1 0x498e46 in process_perf_event /home/honggyu/work/uftrace/utils/perf.c:576 #2 0x487755 in __read_rstack /home/honggyu/work/uftrace/utils/fstack.c:2060 #3 0x488445 in read_rstack /home/honggyu/work/uftrace/utils/fstack.c:2210 #4 0x440503 in build_function_tree /home/honggyu/work/uftrace/cmds/report.c:117 #5 0x440ba3 in report_functions /home/honggyu/work/uftrace/cmds/report.c:227 #6 0x4442ca in command_report /home/honggyu/work/uftrace/cmds/report.c:692 #7 0x40b843 in main /home/honggyu/work/uftrace/uftrace.c:1190 #8 0x7f6c4b8dd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) SUMMARY: AddressSanitizer: 6 byte(s) leaked in 1 allocation(s). Fixed: namhyung#1023 Signed-off-by: Honggyu Kim <[email protected]>
- Loading branch information