Loading
perf stat: Fix memory leakage when trying perf on an offline CPU
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8MEWF CVE: NA -------------------------------- When try to open perf on an offline CPU, ASan complains: ==2316857==ERROR: LeakSanitizer: detected memory leaks Direct leak of 512 byte(s) in 1 object(s) allocated from: #0 0xffff9e774290 in __interceptor_calloc (libasan.so.6+0xa5290) #1 0x62b34c in affinity__setup (/tmp/perf_asan+0x62b34c) #2 0x540d70 in cmd_stat (/tmp/perf_asan+0x540d70) #3 0x59e7e4 in run_builtin (/tmp/perf_asan+0x59e7e4) #4 0x456778 in main (/tmp/perf_asan+0x456778) #5 0xffff9d9c4ff8 (/usr/lib64/libc.so.6+0x2aff8) #6 0xffff9d9c50c4 in __libc_start_main (/usr/lib64/libc.so.6+0x2b0c4) #7 0x523f60 (/tmp/perf_asan+0x523f60) Direct leak of 512 byte(s) in 1 object(s) allocated from: #0 0xffff9e774290 in __interceptor_calloc (libasan.so.6+0xa5290) #1 0x62b370 in affinity__setup (/tmp/perf_asan+0x62b370) #2 0x540d70 in cmd_stat (/tmp/perf_asan+0x540d70) #3 0x59e7e4 in run_builtin (/tmp/perf_asan+0x59e7e4) #4 0x456778 in main (/tmp/perf_asan+0x456778) #5 0xffff9d9c4ff8 (/usr/lib64/libc.so.6+0x2aff8) #6 0xffff9d9c50c4 in __libc_start_main (/usr/lib64/libc.so.6+0x2b0c4) #7 0x523f60 (/tmp/perf_asan+0x523f60) Fix this. Fixes: 4804e011 ("perf stat: Use affinity for opening events") Signed-off-by:Yicong Yang <yangyicong@hisilicon.com> Signed-off-by:
Junhao He <hejunhao3@huawei.com>