Re: [PATCH 07/12] perf jitdump: Free event in jit_repipe_code_move()
Ian Rogers <[email protected]> Wed, 5 Aug 2026 12:09:43 -0700
| Newsgroups | org.kernel.vger.linux-perf-users,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAP-5=fXUpKnWQburVtz9pCvoyUP4_tJFccDhp3JnW4QZ8TiP_A@mail.gmail.com> |
On Wed, Aug 5, 2026 at 6:31 AM Arnaldo Carvalho de Melo <[email protected]> wrote: > > From: Arnaldo Carvalho de Melo <[email protected]> > > jit_repipe_code_move() allocates a perf_event with calloc but never > frees it — the 'out' label exits with only perf_sample__exit(). > > The sibling function jit_repipe_code_load() correctly calls > free(event) at its out label. Add the same free(event) to > jit_repipe_code_move(). > > Fixes: 9b07e27f88b9 ("perf inject: Add jitdump mmap injection support") > Reported-by: sashiko-bot <[email protected]> > Cc: Stephane Eranian <[email protected]> > Assisted-by: Claude:claude-opus-4.6 > Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Thanks! Ian > --- > tools/perf/util/jitdump.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c > index c3f11d1c1d76d6c7..4f52b143cd0da296 100644 > --- a/tools/perf/util/jitdump.c > +++ b/tools/perf/util/jitdump.c > @@ -683,6 +683,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr) > build_id__mark_dso_hit(tool, event, &sample, jd->machine); > out: > perf_sample__exit(&sample); > + free(event); > return ret; > } > > -- > 2.55.0 >