Linux Perf Users
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 6/8] perf timechart: Fix memory leaks during record
Date: Wed, 24 Jun 2026 16:49:08 -0700	[thread overview]
Message-ID: <ajxs9PNznL1mLUFR@google.com> (raw)
In-Reply-To: <20260624210644.F1FEE1F000E9@smtp.kernel.org>

On Wed, Jun 24, 2026 at 09:06:44PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Missing explicit POSIX header inclusion for `free()` (musl compatibility guide violation)
> --
> 
> commit e9f4fbcd6ed720db9d6b0daaf8a565c9bbbd415e
> Author: Namhyung Kim <namhyung@kernel.org>
> 
> perf timechart: Fix memory leaks during record
> 
> The command line options can be passed without copy as their lifetime is
> limited within the same function.
> 
> > diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
> > index 27d17268395ed..a73f0ab22fd64 100644
> > --- a/tools/perf/builtin-timechart.c
> > +++ b/tools/perf/builtin-timechart.c
> [ ... ]
> > @@ -1891,7 +1892,11 @@ static int timechart__io_record(int argc, const char **argv, const char *output_
> >  	for (i = 0; i < (unsigned int)argc; i++)
> >  		*p++ = argv[i];
> >  
> > -	return cmd_record(rec_argc, rec_argv);
> > +	ret = cmd_record(rec_argc, rec_argv);
> > +
> > +	free(rec_argv);
> > +	free(filter);
> 
> [Severity: Medium]
> Does this code need an explicit inclusion of <stdlib.h> at the top of the
> file?
> 
> The perf subsystem musl compatibility guidelines mention that files using
> POSIX libc functions must explicitly include the relevant headers, as musl
> strictly separates declarations unlike glibc. Could these new free() calls
> cause a build failure on systems using musl libc if the header is omitted?

While it may be a valid concern, the free() function is already used in
many places of the file.  And I didn't get any reports about musl on
this yet.  So I think it's good to go.

Thanks,
Namhyung


  reply	other threads:[~2026-06-24 23:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 20:58 [PATCH v3 0/8] perf timechart: Fix memory leaks Namhyung Kim
2026-06-24 20:58 ` [PATCH v3 1/8] perf timechart: Don't pass @event to cat_backtrace() Namhyung Kim
2026-06-24 20:58 ` [PATCH v3 2/8] perf timechart: Generate backtrace only if needed Namhyung Kim
2026-06-24 20:58 ` [PATCH v3 3/8] perf timechart: Remove unused backtrace in trace_handler Namhyung Kim
2026-06-24 20:58 ` [PATCH v3 4/8] perf timechart: Remove unnecessary copy of backtrace Namhyung Kim
2026-06-24 20:58 ` [PATCH v3 5/8] perf timechart: Release event samples at the end Namhyung Kim
2026-06-24 20:58 ` [PATCH v3 6/8] perf timechart: Fix memory leaks during record Namhyung Kim
2026-06-24 21:06   ` sashiko-bot
2026-06-24 23:49     ` Namhyung Kim [this message]
2026-06-24 20:58 ` [PATCH v3 7/8] perf timechart: Fix memory leaks in draw_wakeups() Namhyung Kim
2026-06-24 20:58 ` [PATCH v3 8/8] perf test: Update perf timechart test Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ajxs9PNznL1mLUFR@google.com \
    --to=namhyung@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox