summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-08-22 16:00:28 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-22 16:02:36 -0300
commitfd34f0b26c9d0f3c3c5c5f83207efa6324cd19f7 (patch)
tree56f348f5a12e6282c7a4d610238f1181b8f7bb66 /tools/lib
parent1659d129ed014b715b0b2120e6fd929bdd33ed03 (diff)
downloadlinux-3.10-fd34f0b26c9d0f3c3c5c5f83207efa6324cd19f7.tar.gz
linux-3.10-fd34f0b26c9d0f3c3c5c5f83207efa6324cd19f7.tar.bz2
linux-3.10-fd34f0b26c9d0f3c3c5c5f83207efa6324cd19f7.zip
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')
-rw-r--r--tools/lib/traceevent/event-parse.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index b7c2c491f61..33fcd943f09 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,
struct print_arg *arg, **list;
/* old ftrace had no args */
-
list = &event->print_fmt.args;
for (field = event->format.fields; field; field = field->next) {
arg = alloc_arg();
- *list = arg;
- list = &arg->next;
arg->type = PRINT_FIELD;
arg->field.name = strdup(field->name);
if (!arg->field.name) {
do_warning("failed to allocate field name");
event->flags |= EVENT_FL_FAILED;
+ free_arg(arg);
return -1;
}
arg->field.field = field;
+ *list = arg;
+ list = &arg->next;
}
return 0;
}