[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241019154157.282038-3-lihuafei1@huawei.com>
Date: Sat, 19 Oct 2024 23:41:57 +0800
From: Li Huafei <lihuafei1@...wei.com>
To: <namhyung@...nel.org>, <atrajeev@...ux.vnet.ibm.com>
CC: <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
<mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
<jolsa@...nel.org>, <irogers@...gle.com>, <adrian.hunter@...el.com>,
<kan.liang@...ux.intel.com>, <kjain@...ux.ibm.com>, <sesse@...gle.com>,
<linux-perf-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<lihuafei1@...wei.com>
Subject: [PATCH v2 3/3] 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@...wei.com>
---
Changes in v2:
- Break directly in the loop when it fails, then free disasm_line.
---
tools/perf/util/disasm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c
index 8a24e31a1534..250cc5ef4762 100644
--- a/tools/perf/util/disasm.c
+++ b/tools/perf/util/disasm.c
@@ -1770,7 +1770,7 @@ static int symbol__disassemble_raw(char *filename, struct symbol *sym,
sprintf(args->line, "%x", line[i]);
dl = disasm_line__new(args);
if (dl == NULL)
- goto err;
+ break;
annotation_line__add(&dl->al, ¬es->src->source);
offset += 4;
--
2.25.1
Powered by blists - more mailing lists