From: Jiri Olsa <jolsa@redhat.com>
To: Zheng Zengkai <zhengzengkai@huawei.com>
Cc: acme@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, namhyung@kernel.org,
linux-kernel@vger.kernel.org, huawei.libin@huawei.com
Subject: Re: [PATCH -next] perf util: Fix memory leak in __parse_regs()
Date: Fri, 3 Jul 2020 12:31:06 +0200 [thread overview]
Message-ID: <20200703103106.GA3261456@krava> (raw)
In-Reply-To: <20200703093344.189450-1-zhengzengkai@huawei.com>
On Fri, Jul 03, 2020 at 05:33:44PM +0800, Zheng Zengkai wrote:
> when using perf record option '-I' or '--user-regs='
> along with argument '?' to list available register names,
> memory of variable 'os' allocated by strdup() needs to be released
> before __parse_regs() returns, otherwise memory leak will occur.
>
> Fixes: bcc84ec65ad1 ("perf record: Add ability to name registers to record")
> Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
thanks,
jirka
> ---
> tools/perf/util/parse-regs-options.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c
> index e687497b3aac..a4a100425b3a 100644
> --- a/tools/perf/util/parse-regs-options.c
> +++ b/tools/perf/util/parse-regs-options.c
> @@ -54,7 +54,7 @@ __parse_regs(const struct option *opt, const char *str, int unset, bool intr)
> #endif
> fputc('\n', stderr);
> /* just printing available regs */
> - return -1;
> + goto error;
> }
> #ifdef HAVE_PERF_REGS_SUPPORT
> for (r = sample_reg_masks; r->name; r++) {
> --
> 2.20.1
>
next prev parent reply other threads:[~2020-07-03 10:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-03 9:33 [PATCH -next] perf util: Fix memory leak in __parse_regs() Zheng Zengkai
2020-07-03 10:31 ` Jiri Olsa [this message]
2020-11-27 7:45 ` Zheng Zengkai
2020-12-07 16:45 ` Arnaldo Carvalho de Melo
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=20200703103106.GA3261456@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=huawei.libin@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=namhyung@kernel.org \
--cc=zhengzengkai@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.