aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-09-19 02:58:44 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-09-24 11:03:18 -0400
commit70d9304475730a63dd8da884abc7c76ee4772cd2 (patch)
tree8b9bbada6f72cbf601f060c50145d4b38a42358d /tools/lib
parentf8c49d2645e5028e48ba15ec72728be121eddf95 (diff)
tools lib traceevent: Free field if an error occurs on process_flags/symbols
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-5-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/traceevent/event-parse.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index a776ed5cd2b4..acf40381b48b 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2247,7 +2247,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
2247 type = process_op(event, field, &token); 2247 type = process_op(event, field, &token);
2248 2248
2249 if (test_type_token(type, token, EVENT_DELIM, ",")) 2249 if (test_type_token(type, token, EVENT_DELIM, ","))
2250 goto out_free; 2250 goto out_free_field;
2251 free_token(token); 2251 free_token(token);
2252 2252
2253 arg->flags.field = field; 2253 arg->flags.field = field;
@@ -2269,7 +2269,9 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
2269 type = read_token_item(tok); 2269 type = read_token_item(tok);
2270 return type; 2270 return type;
2271 2271
2272 out_free: 2272out_free_field:
2273 free_arg(field);
2274out_free:
2273 free_token(token); 2275 free_token(token);
2274 *tok = NULL; 2276 *tok = NULL;
2275 return EVENT_ERROR; 2277 return EVENT_ERROR;
@@ -2289,7 +2291,7 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok)
2289 2291
2290 type = process_arg(event, field, &token); 2292 type = process_arg(event, field, &token);
2291 if (test_type_token(type, token, EVENT_DELIM, ",")) 2293 if (test_type_token(type, token, EVENT_DELIM, ","))
2292 goto out_free; 2294 goto out_free_field;
2293 2295
2294 arg->symbol.field = field; 2296 arg->symbol.field = field;
2295 2297
@@ -2301,7 +2303,9 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok)
2301 type = read_token_item(tok); 2303 type = read_token_item(tok);
2302 return type; 2304 return type;
2303 2305
2304 out_free: 2306out_free_field:
2307 free_arg(field);
2308out_free:
2305 free_token(token); 2309 free_token(token);
2306 *tok = NULL; 2310 *tok = NULL;
2307 return EVENT_ERROR; 2311 return EVENT_ERROR;