aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-05-22 22:36:47 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-05-24 10:32:10 -0400
commit57d34dc5568f6ac700ef7e5c67f2bd6a8c7c4659 (patch)
tree72989e742058c212f39b184d94acbba223873a47 /tools/lib
parent00b9da7219cd027a1c51c3ef576aadbbd9fe38fe (diff)
tools lib traceevent: Fix a possible memory leak
If event_read_fields failed in the middle, each member of struct format_field should be freed also. Cc: Borislav Petkov <bp@alien8.de> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1337740619-27925-11-git-send-email-namhyung.kim@lge.com Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/traceevent/event-parse.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 33450c901e17..d598b376e3c1 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -1434,8 +1434,11 @@ static int event_read_fields(struct event_format *event, struct format_field **f
1434fail: 1434fail:
1435 free_token(token); 1435 free_token(token);
1436fail_expect: 1436fail_expect:
1437 if (field) 1437 if (field) {
1438 free(field->type);
1439 free(field->name);
1438 free(field); 1440 free(field);
1441 }
1439 return -1; 1442 return -1;
1440} 1443}
1441 1444