Messages in this thread | | | Date | Sun, 5 Oct 2014 21:02:23 +0200 | From | Jiri Olsa <> | Subject | Re: [PATCH V7 2/4] perf tools: parse the pmu event prefix and suffix |
| |
On Fri, Oct 03, 2014 at 12:09:06PM -0400, kan.liang@intel.com wrote: > From: Kan Liang <kan.liang@intel.com>
SNIP
> +/* > + * Read the pmu events list from sysfs > + * Save it into perf_pmu_events_list > + */ > +static void perf_pmu__parse_init(void) > +{ > + > + struct perf_pmu *pmu = NULL; > + struct perf_pmu_alias *alias; > + int len = 0; > + > + pmu = perf_pmu__find("cpu"); > + if ((pmu == NULL) || list_empty(&pmu->aliases)) { > + perf_pmu_events_list_num = -1; > + return; > + } > + list_for_each_entry(alias, &pmu->aliases, list) { > + if (strchr(alias->name, '-')) > + len++; > + len++; > + } > + perf_pmu_events_list = malloc(sizeof(struct perf_pmu_event_symbol) * len); > + perf_pmu_events_list_num = len;
missing allocation failure check
jirka
| |