Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Namhyung Kim" <namhyung@kernel.org>
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 21:06:44 +0000	[thread overview]
Message-ID: <20260624210644.F1FEE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260624205852.3864874-7-namhyung@kernel.org>

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?

> +	return ret;
>  }
>  
>  
[ ... ]
> @@ -1966,24 +1972,27 @@ static int timechart__record(struct timechart *tchart, int argc, const char **ar
[ ... ]
>  	for (j = 0; j < (unsigned int)argc; j++)
>  		*p++ = argv[j];
>  
> -	return cmd_record(rec_argc, rec_argv);
> +	ret = cmd_record(rec_argc, rec_argv);
> +
> +	free(rec_argv);

[Severity: Medium]
Is it possible this free() call also requires an explicit <stdlib.h>
inclusion to ensure it builds correctly against musl libc?

> +	return ret;
>  }
>  
>  static int

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260624205852.3864874-1-namhyung@kernel.org?part=6

  reply	other threads:[~2026-06-24 21:06 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 [this message]
2026-06-24 23:49     ` Namhyung Kim
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=20260624210644.F1FEE1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@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