lkml.org 
[lkml]   [2014]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2014-10-05 21:41    [W:0.405 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site