Re: [PATCH] perf llvm: Fix memory leak of args->fileloc in symbol__disassemble_llvm()
From: Arnaldo Carvalho de Melo
Date: Fri Sep 25 2026 - 06:02:01 EST
On Mon, Sep 21, 2026 at 11:36:08AM -0700, Ian Rogers wrote:
> On Thu, Sep 17, 2026 at 5:58 AM Tengda Wu <wutengda@xxxxxxxxxxxxxxx> wrote:
> > In symbol__disassemble_llvm(), after calling llvm_addr2line(), if the
> > subsequent disasm_line__new() fails, the code directly jumps to 'err'
> > without freeing args->fileloc, leading to a memory leak.
> > Fix this by explicitly calling free(args->fileloc) before jumping to
> > the error handling path when disasm_line__new() fails.
> > Fixes: 048856817888 ("perf annotate: LLVM-based disassembler")
> > Signed-off-by: Tengda Wu <wutengda@xxxxxxxxxxxxxxx>
> Reviewed-by: Ian Rogers <irogers@xxxxxxxxxx>
I replaced the free() with a zfree(&), minor.
Thanks, applied to perf-tools-next, for v7.4.
- Arnaldo