diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-08-22 03:00:28 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-08-22 15:02:36 -0400 |
commit | fd34f0b26c9d0f3c3c5c5f83207efa6324cd19f7 (patch) | |
tree | 56f348f5a12e6282c7a4d610238f1181b8f7bb66 /tools/lib/traceevent | |
parent | 1659d129ed014b715b0b2120e6fd929bdd33ed03 (diff) |
tools lib traceevent: Do not link broken field arg for an old ftrace event
Defer linking a newly allocated arg to print_fmt.args until all of its
field is setup so that later access to ->field.name cannot be NULL.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1345618831-9148-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/traceevent')
-rw-r--r-- | tools/lib/traceevent/event-parse.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index b7c2c491f61e..33fcd943f096 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
@@ -4754,20 +4754,20 @@ int pevent_parse_event(struct pevent *pevent, | |||
4754 | struct print_arg *arg, **list; | 4754 | struct print_arg *arg, **list; |
4755 | 4755 | ||
4756 | /* old ftrace had no args */ | 4756 | /* old ftrace had no args */ |
4757 | |||
4758 | list = &event->print_fmt.args; | 4757 | list = &event->print_fmt.args; |
4759 | for (field = event->format.fields; field; field = field->next) { | 4758 | for (field = event->format.fields; field; field = field->next) { |
4760 | arg = alloc_arg(); | 4759 | arg = alloc_arg(); |
4761 | *list = arg; | ||
4762 | list = &arg->next; | ||
4763 | arg->type = PRINT_FIELD; | 4760 | arg->type = PRINT_FIELD; |
4764 | arg->field.name = strdup(field->name); | 4761 | arg->field.name = strdup(field->name); |
4765 | if (!arg->field.name) { | 4762 | if (!arg->field.name) { |
4766 | do_warning("failed to allocate field name"); | 4763 | do_warning("failed to allocate field name"); |
4767 | event->flags |= EVENT_FL_FAILED; | 4764 | event->flags |= EVENT_FL_FAILED; |
4765 | free_arg(arg); | ||
4768 | return -1; | 4766 | return -1; |
4769 | } | 4767 | } |
4770 | arg->field.field = field; | 4768 | arg->field.field = field; |
4769 | *list = arg; | ||
4770 | list = &arg->next; | ||
4771 | } | 4771 | } |
4772 | return 0; | 4772 | return 0; |
4773 | } | 4773 | } |