]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:53:48 +0000 (13:53 +0100)
[ Upstream commit b4e0e9a1e30059f4523c9b6a1f8045ad89b5db8a ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/perf/util/disasm.c

index 766cbd005f32a86efba2a1f342bddc39464b8d97..c2ce33e447e35b1c8c5480d2dbd03e0255544ca7 100644 (file)
@@ -1391,7 +1391,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;