perf disasm: Use disasm_line__free() to properly free disasm_line
authorLi Huafei <lihuafei1@huawei.com>
Sat, 19 Oct 2024 15:41:55 +0000 (23:41 +0800)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 23 Oct 2024 22:35:38 +0000 (15:35 -0700)
The structure disasm_line contains members that require dynamically
allocated memory and need to be freed correctly using
disasm_line__free().

This patch fixes the incorrect release in
symbol__disassemble_capstone().

Fixes: 6d17edc113de ("perf annotate: Use libcapstone to disassemble")
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
Tested-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: sesse@google.com
Cc: kjain@linux.ibm.com
Link: https://lore.kernel.org/r/20241019154157.282038-1-lihuafei1@huawei.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/disasm.c

index aef06a36bf40a7dfc3ba807283908a2ad72b7a33..053b1f9ccc71ed80f4cc27ee84c85b3bc8dd1b68 100644 (file)
@@ -1720,7 +1720,7 @@ err:
                 */
                list_for_each_entry_safe(dl, tmp, &notes->src->source, al.node) {
                        list_del(&dl->al.node);
-                       free(dl);
+                       disasm_line__free(dl);
                }
        }
        count = -1;