diff options
author | Colin Ian King <colin.king@canonical.com> | 2014-02-27 18:21:03 +0000 |
---|---|---|
committer | Alexandra Yates <alexandra.yates@linux.intel.com> | 2014-04-02 18:48:18 -0700 |
commit | 3c07c386168d8e5f1043771f65fbe298d3ce9936 (patch) | |
tree | 9bcfbbee39fd2c202b1f9abee98d4194cc7a5c28 /traceevent/event-parse.c | |
parent | 39791b10280d64403afd5ad521c3c89ec686a794 (diff) |
event-parse: don't free uninitialized token
When alloc_arg() allocation fails token is free'd in the error
exit path, however, at that point token has not been allocated
which can break free(). This fix avoids the erroneous free of
token on the error exit.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Diffstat (limited to 'traceevent/event-parse.c')
-rw-r--r-- | traceevent/event-parse.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/traceevent/event-parse.c b/traceevent/event-parse.c index d1c2a6a..f63a262 100644 --- a/traceevent/event-parse.c +++ b/traceevent/event-parse.c @@ -2351,7 +2351,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok) field = alloc_arg(); if (!field) { do_warning("%s: not enough memory!", __func__); - goto out_free; + goto out; } type = process_arg(event, field, &token); @@ -2387,6 +2387,7 @@ out_free_field: free_arg(field); out_free: free_token(token); +out: *tok = NULL; return EVENT_ERROR; } @@ -2404,7 +2405,7 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok) field = alloc_arg(); if (!field) { do_warning("%s: not enough memory!", __func__); - goto out_free; + goto out; } type = process_arg(event, field, &token); @@ -2425,6 +2426,7 @@ out_free_field: free_arg(field); out_free: free_token(token); +out: *tok = NULL; return EVENT_ERROR; } @@ -2442,7 +2444,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok) field = alloc_arg(); if (!field) { do_warning("%s: not enough memory!", __func__); - goto out_free; + goto out; } type = process_arg(event, field, &token); @@ -2475,6 +2477,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok) out_free: free_arg(field); free_token(token); +out: *tok = NULL; return EVENT_ERROR; } |