aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2015-07-17 12:07:23 -0400
committerSteven Rostedt <rostedt@goodmis.org>2015-07-20 17:50:42 -0400
commitc93e4e9da57c3c002d67c740ad9e46b55ba3c9cf (patch)
tree53cdaae924cf5e93fb24cde3ecb812e588b13cf9
parenta39e67c0c179e9168aa6210999779d7be4ddf1c3 (diff)
downloadtrace-cmd-c93e4e9da57c3c002d67c740ad9e46b55ba3c9cf.tar.gz
trace-cmd: 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>
-rw-r--r--event-parse.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/event-parse.c b/event-parse.c
index cc25f059..1e28f767 100644
--- a/event-parse.c
+++ b/event-parse.c
@@ -2559,6 +2559,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok)
free_field:
free_arg(arg->hex.field);
+ arg->hex.field = NULL;
out:
*tok = NULL;
return EVENT_ERROR;
@@ -2583,8 +2584,10 @@ process_int_array(struct event_format *event, struct print_arg *arg, char **tok)
free_size:
free_arg(arg->int_array.count);
+ arg->int_array.count = NULL;
free_field:
free_arg(arg->int_array.field);
+ arg->int_array.field = NULL;
out:
*tok = NULL;
return EVENT_ERROR;