Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf disasm: Fix not cleaning up disasm_line in symbol__disassemble_raw()

In symbol__disassemble_raw(), the created disasm_line should be
discarded before returning an error. When creating disasm_line fails,
break the loop and then release the created lines.

Fixes: 0b971e6bf1c3 ("perf annotate: Add support to capture and parse raw instruction in powerpc using dso__data_read_offset utility")
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-3-lihuafei1@huawei.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Li Huafei and committed by
Namhyung Kim
150dab31 908d50e5

+1 -1
+1 -1
tools/perf/util/disasm.c
··· 1773 1773 sprintf(args->line, "%x", line[i]); 1774 1774 dl = disasm_line__new(args); 1775 1775 if (dl == NULL) 1776 - goto err; 1776 + break; 1777 1777 1778 1778 annotation_line__add(&dl->al, &notes->src->source); 1779 1779 offset += 4;