Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error

Jiri Olsa
2017-08-22T07:23:57Z

On Thu, Aug 17, 2017 at 02:22:32PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Aug 17, 2017 at 10:04:53AM -0700, Andi Kleen escreveu:
> > > So it will _not_ set to null a member that it doesn't have, i.e. the
> > > minimal fix is to just have the hunks below, making sure that the error
> > > field is present in both structs. No need to set
> > > parse_event_terms->error to anything, it will be set to null since other
> > > fields are set to something.
> >
> > Right but I want to see the error too. That is why I added a real
> > error handler.
>
> Ok, but I was first trying to figure out the fix for that separate
> problem (the void pointer being dereferenced to two different types in
> the same function, yyparse, aka parse_events_parse), then we can go to
> the 'too' part :-)
>
> I'm adding the patch below, that should fix things by using just one
> state struct for parsing.
>
> This is done on top of another that renames 'struct parse_events_evlist'
> to a more clearer 'struct parse_events_state'.
>
> I'll then add what is left of your patch, run tests and we go from
> there, holler if I'm now missing something.

nice catch, I saw the fixes in your branch, look ok

thanks,
jirka