diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-09-19 02:58:43 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-09-24 11:02:38 -0400 |
commit | f8c49d2645e5028e48ba15ec72728be121eddf95 (patch) | |
tree | 22633de0516f496d876d7ceabd55adf31ba8c91a /tools | |
parent | 41e51a289b3ca83e08395213f4488c9c7c6b2e29 (diff) |
tools lib traceevent: Free field if an error occurs on process_fields
The field should be freed on error paths.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1348037924-17568-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/traceevent/event-parse.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 27088c55af1b..a776ed5cd2b4 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
@@ -2186,10 +2186,10 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char ** | |||
2186 | 2186 | ||
2187 | value = arg_eval(arg); | 2187 | value = arg_eval(arg); |
2188 | if (value == NULL) | 2188 | if (value == NULL) |
2189 | goto out_free; | 2189 | goto out_free_field; |
2190 | field->value = strdup(value); | 2190 | field->value = strdup(value); |
2191 | if (field->value == NULL) | 2191 | if (field->value == NULL) |
2192 | goto out_free; | 2192 | goto out_free_field; |
2193 | 2193 | ||
2194 | free_arg(arg); | 2194 | free_arg(arg); |
2195 | arg = alloc_arg(); | 2195 | arg = alloc_arg(); |
@@ -2197,14 +2197,14 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char ** | |||
2197 | free_token(token); | 2197 | free_token(token); |
2198 | type = process_arg(event, arg, &token); | 2198 | type = process_arg(event, arg, &token); |
2199 | if (test_type_token(type, token, EVENT_OP, "}")) | 2199 | if (test_type_token(type, token, EVENT_OP, "}")) |
2200 | goto out_free; | 2200 | goto out_free_field; |
2201 | 2201 | ||
2202 | value = arg_eval(arg); | 2202 | value = arg_eval(arg); |
2203 | if (value == NULL) | 2203 | if (value == NULL) |
2204 | goto out_free; | 2204 | goto out_free_field; |
2205 | field->str = strdup(value); | 2205 | field->str = strdup(value); |
2206 | if (field->str == NULL) | 2206 | if (field->str == NULL) |
2207 | goto out_free; | 2207 | goto out_free_field; |
2208 | free_arg(arg); | 2208 | free_arg(arg); |
2209 | arg = NULL; | 2209 | arg = NULL; |
2210 | 2210 | ||
@@ -2218,6 +2218,8 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char ** | |||
2218 | *tok = token; | 2218 | *tok = token; |
2219 | return type; | 2219 | return type; |
2220 | 2220 | ||
2221 | out_free_field: | ||
2222 | free_flag_sym(field); | ||
2221 | out_free: | 2223 | out_free: |
2222 | free_arg(arg); | 2224 | free_arg(arg); |
2223 | free_token(token); | 2225 | free_token(token); |