diff options
| author | Li Huafei <[email protected]> | 2024-10-19 15:41:56 +0000 |
|---|---|---|
| committer | Namhyung Kim <[email protected]> | 2024-10-23 22:36:06 +0000 |
| commit | 908d50e50ef91713ae94bc8988db87def6b6fec3 (patch) | |
| tree | d4e9a7a3f6498750cf739d735744b0869c037cd2 /tools/perf/builtin-script.c | |
| parent | perf disasm: Use disasm_line__free() to properly free disasm_line (diff) | |
| download | kernel-908d50e50ef91713ae94bc8988db87def6b6fec3.tar.gz kernel-908d50e50ef91713ae94bc8988db87def6b6fec3.zip | |
perf disasm: Use disasm_line__free() to properly free disasm_line
symbol__disassemble_capstone_powerpc() goto the 'err' label when it
failed in the loop that created disasm_line, and then used free()
directly to free disasm_line. Since the structure disasm_line contains
members that allocate memory dynamically, this can result in a memory
leak. In fact, we can simply break the loop when it fails in the middle
of the loop, and disasm_line__free() will then be called to properly
free the created line. Other error paths do not need to consider freeing
disasm_line.
Fixes: c5d60de1813a ("perf annotate: Add support to use libcapstone in powerpc")
Signed-off-by: Li Huafei <[email protected]>
Tested-by: Athira Rajeev <[email protected]>
Cc: [email protected]
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Namhyung Kim <[email protected]>
Diffstat (limited to 'tools/perf/builtin-script.c')
0 files changed, 0 insertions, 0 deletions
