From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Yunlong Song <yunlong.song@huawei.com>
Cc: a.p.zijlstra@chello.nl, paulus@samba.org, mingo@redhat.com,
linux-kernel@vger.kernel.org, wangnan0@huawei.com
Subject: Re: [PATCH v3 1/7] perf list: Sort the output of 'perf list' to view more clearly
Date: Fri, 27 Feb 2015 10:57:27 -0300 [thread overview]
Message-ID: <20150227135727.GH13373@kernel.org> (raw)
In-Reply-To: <1425032491-20224-2-git-send-email-yunlong.song@huawei.com>
Em Fri, Feb 27, 2015 at 06:21:25PM +0800, Yunlong Song escreveu:
> Sort the output according to ASCII character list (using strcmp), which
> supports both number sequence and alphabet sequence.
That is a great feature to have, thanks!
But you are not calling closedir() if zalloc fails, I am fixing that for
you this time, please check those kinds of things in the future.
- Arnaldo
> @@ -1100,11 +1108,21 @@ void print_tracepoint_events(const char *subsys_glob, const char *event_glob,
> struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
> char evt_path[MAXPATHLEN];
> char dir_path[MAXPATHLEN];
> + char **evt_list = NULL;
> + unsigned int evt_i = 0, evt_num = 0;
> + bool evt_num_known = false;
>
> +restart:
> sys_dir = opendir(tracing_events_path);
> if (!sys_dir)
> return;
>
> + if (evt_num_known) {
> + evt_list = zalloc(sizeof(char *) * evt_num);
> + if (!evt_list)
> + goto out_enomem;
Here, zalloc fails, goto out_enomem, closedir() not called.
> +out_free:
> + evt_num = evt_i;
> + for (evt_i = 0; evt_i < evt_num; evt_i++)
> + zfree(&evt_list[evt_i]);
> + zfree(&evt_list);
> + return;
> +
> +out_enomem:
> + printf("FATAL: not enough memory to print %s\n",
> + event_type_descriptors[PERF_TYPE_TRACEPOINT]);
> + if (evt_list)
> + goto out_free;
> }
next prev parent reply other threads:[~2015-02-27 13:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 10:21 [PATCH v3 0/7] perf core: Make some improvements and fixes Yunlong Song
2015-02-27 10:21 ` [PATCH v3 1/7] perf list: Sort the output of 'perf list' to view more clearly Yunlong Song
2015-02-27 13:57 ` Arnaldo Carvalho de Melo [this message]
2015-02-28 9:32 ` [tip:perf/core] " tip-bot for Yunlong Song
2015-02-27 10:21 ` [PATCH v3 2/7] perf list: Fix some inaccuracy problem when parsing the argument Yunlong Song
2015-02-28 9:33 ` [tip:perf/core] perf list: Allow listing events with 'tracepoint' prefix tip-bot for Yunlong Song
2015-02-27 10:21 ` [PATCH v3 3/7] perf list: Clean up the printing functions of hardware/software events Yunlong Song
2015-02-28 9:34 ` [tip:perf/core] " tip-bot for Yunlong Song
2015-02-27 10:21 ` [PATCH v3 4/7] perf list: Extend raw-dump to certain kind of events Yunlong Song
2015-02-27 15:20 ` Arnaldo Carvalho de Melo
2015-02-27 15:23 ` Arnaldo Carvalho de Melo
2015-02-28 9:34 ` [tip:perf/core] " tip-bot for Yunlong Song
2015-02-27 10:21 ` [PATCH v3 5/7] perf list: Avoid confusion of perf output and the next command prompt Yunlong Song
2015-02-28 9:33 ` [tip:perf/core] " tip-bot for Yunlong Song
2015-02-27 10:21 ` [PATCH v3 6/7] perf record: Remove the '--(null)' long_name for --list-opts Yunlong Song
2015-02-28 9:33 ` [tip:perf/core] perf tools: " tip-bot for Yunlong Song
2015-02-27 10:21 ` [PATCH v3 7/7] perf core: Fix the bash completion problem of 'perf --*' Yunlong Song
2015-02-28 9:34 ` [tip:perf/core] perf tools: Fix the bash completion problem of ' perf --*' tip-bot for Yunlong Song
2015-02-27 15:27 ` [PATCH v3 0/7] perf core: Make some improvements and fixes 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=20150227135727.GH13373@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=wangnan0@huawei.com \
--cc=yunlong.song@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox