aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNamhyung Kim <[email protected]>2012-05-23 11:36:47 +0900
committerArnaldo Carvalho de Melo <[email protected]>2012-05-24 11:32:10 -0300
commit57d34dc5568f6ac700ef7e5c67f2bd6a8c7c4659 (patch)
tree72989e742058c212f39b184d94acbba223873a47
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 <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]> Signed-off-by: Steven Rostedt <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-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
fail:
free_token(token);
fail_expect:
- if (field)
+ if (field) {
+ free(field->type);
+ free(field->name);
free(field);
+ }
return -1;
}