Re: [PATCH 04/14] perf tools: Add fake pmu support

Jiri Olsa
2020-06-01T09:06:48Z

On Mon, Jun 01, 2020 at 12:22:30AM -0700, Ian Rogers wrote:

SNIP

> > +
> > + list = alloc_list();
> > + if (!list)
> > + YYABORT;
> > +
> > + err = parse_events_add_pmu(_parse_state, list, $1, NULL, false, false);
> > + free($1);
> > + if (err < 0)
>
> nit: on error this needs:
> free(list);
> otherwise something like fuzz testing could go down the error path and
> complain about memory leaks.

right, I'll add that

thanks,
jirka

>
> Thanks,
> Ian
>
> > + YYABORT;
> > + $$ = list;
> > +}
> > +|
> > +PE_PMU_EVENT_FAKE opt_pmu_config
> > +{
> > + struct list_head *list;
> > + int err;
> > +
> > + list = alloc_list();
> > + if (!list)
> > + YYABORT;
> > +
> > + err = parse_events_add_pmu(_parse_state, list, $1, $2, false, false);
> > + free($1);
> > + parse_events_terms__delete($2);
> > + if (err < 0)
> > + YYABORT;
> > + $$ = list;
> > +}
> >
> > value_sym:
> > PE_VALUE_SYM_HW
> > --
> > 2.25.4
> >
>