From 57d34dc5568f6ac700ef7e5c67f2bd6a8c7c4659 Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Wed, 23 May 2012 11:36:47 +0900 Subject: 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 Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1337740619-27925-11-git-send-email-namhyung.kim@lge.com Signed-off-by: Namhyung Kim Signed-off-by: Steven Rostedt Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/traceevent/event-parse.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 33450c901e1..d598b376e3c 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 fail: free_token(token); fail_expect: - if (field) + if (field) { + free(field->type); + free(field->name); free(field); + } return -1; } -- cgit v1.2.3-18-g5258