提交 9ec72eaf 编写于 作者: S Steven Rostedt (Red Hat) 提交者: Arnaldo Carvalho de Melo

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: NSteven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20160209204237.188327674@goodmis.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 21a30100
...@@ -2635,6 +2635,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -2635,6 +2635,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok)
free_field: free_field:
free_arg(arg->hex.field); free_arg(arg->hex.field);
arg->hex.field = NULL;
out: out:
*tok = NULL; *tok = NULL;
return EVENT_ERROR; return EVENT_ERROR;
...@@ -2659,8 +2660,10 @@ process_int_array(struct event_format *event, struct print_arg *arg, char **tok) ...@@ -2659,8 +2660,10 @@ process_int_array(struct event_format *event, struct print_arg *arg, char **tok)
free_size: free_size:
free_arg(arg->int_array.count); free_arg(arg->int_array.count);
arg->int_array.count = NULL;
free_field: free_field:
free_arg(arg->int_array.field); free_arg(arg->int_array.field);
arg->int_array.field = NULL;
out: out:
*tok = NULL; *tok = NULL;
return EVENT_ERROR; return EVENT_ERROR;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册