aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/traceevent/event-parse.c
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2016-02-09 15:40:16 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-03-03 09:10:38 -0500
commit9ec72eafee61f68cd57310a99db129ffb71302f3 (patch)
tree44c814b7d977765424c15eda214be62cb58a5844 /tools/lib/traceevent/event-parse.c
parent21a30100453516004905d4d5f0806ebaffa95131 (diff)
tools lib traceevent: Set int_array fields to NULL if freeing from error
Had a bug where on error of parsing __print_array() where the fields are freed after they were allocated, but since they were not set to NULL, the freeing of the arg also tried to free the already freed fields causing a double free. Fix process_hex() while at it. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Cc: Andrew Morton <akpm@linux-foundation.org> Link: http://lkml.kernel.org/r/20160209204237.188327674@goodmis.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/traceevent/event-parse.c')
-rw-r--r--tools/lib/traceevent/event-parse.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index ce59f4891fa2..fb790aa757eb 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2635,6 +2635,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok)
2635 2635
2636free_field: 2636free_field:
2637 free_arg(arg->hex.field); 2637 free_arg(arg->hex.field);
2638 arg->hex.field = NULL;
2638out: 2639out:
2639 *tok = NULL; 2640 *tok = NULL;
2640 return EVENT_ERROR; 2641 return EVENT_ERROR;
@@ -2659,8 +2660,10 @@ process_int_array(struct event_format *event, struct print_arg *arg, char **tok)
2659 2660
2660free_size: 2661free_size:
2661 free_arg(arg->int_array.count); 2662 free_arg(arg->int_array.count);
2663 arg->int_array.count = NULL;
2662free_field: 2664free_field:
2663 free_arg(arg->int_array.field); 2665 free_arg(arg->int_array.field);
2666 arg->int_array.field = NULL;
2664out: 2667out:
2665 *tok = NULL; 2668 *tok = NULL;
2666 return EVENT_ERROR; 2669 return EVENT_ERROR;