Re: [PATCH v3 2/9] perf tools: splice events onto evlist even on error

From
Jiri Olsa <hidden>
Date
2019-10-28 21:06:58
Also in
bpf, lkml
Reply to
Ian Rogers, 2019-10-25
On Fri, Oct 25, 2019 at 08:47:12AM -0700, Ian Rogers wrote:

SNIP
event_pmu: PE_NAME opt_event_config
{
...
ALLOC_LIST(list);  // <--- where list gets allocated
...
https://github.com/torvalds/linux/blob/master/tools/perf/util/parse-events.y#L229

opt_event_config:
https://github.com/torvalds/linux/blob/master/tools/perf/util/parse-events.y#L510

So the parse_state is ending up with a list, however, parsing is
failing. If the list isn't adding to the evlist then it becomes a
leak. Splicing it onto the evlist allows the caller to clean this up
and avoids the leak. An alternate approach is to free the failed list
and not get the caller to clean up. A way to do this is to create an
evlist, splice the failed list onto it and then free it - which winds
up being fairly identical to this approach, and this approach is a
smaller change.
agreed, thanks for the all the details

jirka
Thread (101 messages) 101 messages, 4 authors, last reply 2019-11-12
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help