Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
perf disasm: Use disasm_line__free() to properly free disasm_line
Browse files Browse the repository at this point in the history
[ Upstream commit b4e0e9a ]

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: 6d17edc ("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>
  • Loading branch information
Li Huafei authored and gregkh committed Dec 3, 2024
1 parent 94177cb commit ae5ff32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/perf/util/disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ static int symbol__disassemble_capstone(char *filename, struct symbol *sym,
*/
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;
Expand Down

0 comments on commit ae5ff32

Please sign in to comment.