aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2012-05-24 13:03:00 -0400
committerIngo Molnar <mingo@kernel.org>2012-05-24 13:03:00 -0400
commitc985f7812331d79483beab932e8966477411a942 (patch)
tree5c4a47df4e954f3439df148eb397ea3ff164b94e
parente76df19bd986656e3c9f4a62e3dd15e7d69b607a (diff)
parenteaec12d7f526694f24d581a4ad23de6ce0315cd2 (diff)
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Fixes for the recently merged libtraceevent, from Arnaldo Carvalho de Melo: * Selected fixes for libtraceevent, from various contributors, submitter by Namhyung Kim in agreement with Steven Rostedt, all from the trace-cmd repo, i.e. they have been in use for quite a while in trace-cmd. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--tools/lib/traceevent/event-parse.c22
-rw-r--r--tools/lib/traceevent/parse-filter.c5
2 files changed, 20 insertions, 7 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 998534992197..554828219c33 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -1434,8 +1434,11 @@ static int event_read_fields(struct event_format *event, struct format_field **f
1434fail: 1434fail:
1435 free_token(token); 1435 free_token(token);
1436fail_expect: 1436fail_expect:
1437 if (field) 1437 if (field) {
1438 free(field->type);
1439 free(field->name);
1438 free(field); 1440 free(field);
1441 }
1439 return -1; 1442 return -1;
1440} 1443}
1441 1444
@@ -1712,6 +1715,8 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
1712 1715
1713 if (set_op_prio(arg) == -1) { 1716 if (set_op_prio(arg) == -1) {
1714 event->flags |= EVENT_FL_FAILED; 1717 event->flags |= EVENT_FL_FAILED;
1718 /* arg->op.op (= token) will be freed at out_free */
1719 arg->op.op = NULL;
1715 goto out_free; 1720 goto out_free;
1716 } 1721 }
1717 1722
@@ -2124,6 +2129,13 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char **
2124 2129
2125 free_token(token); 2130 free_token(token);
2126 type = process_arg(event, arg, &token); 2131 type = process_arg(event, arg, &token);
2132
2133 if (type == EVENT_OP)
2134 type = process_op(event, arg, &token);
2135
2136 if (type == EVENT_ERROR)
2137 goto out_free;
2138
2127 if (test_type_token(type, token, EVENT_DELIM, ",")) 2139 if (test_type_token(type, token, EVENT_DELIM, ","))
2128 goto out_free; 2140 goto out_free;
2129 2141
@@ -2288,17 +2300,18 @@ process_dynamic_array(struct event_format *event, struct print_arg *arg, char **
2288 arg = alloc_arg(); 2300 arg = alloc_arg();
2289 type = process_arg(event, arg, &token); 2301 type = process_arg(event, arg, &token);
2290 if (type == EVENT_ERROR) 2302 if (type == EVENT_ERROR)
2291 goto out_free; 2303 goto out_free_arg;
2292 2304
2293 if (!test_type_token(type, token, EVENT_OP, "]")) 2305 if (!test_type_token(type, token, EVENT_OP, "]"))
2294 goto out_free; 2306 goto out_free_arg;
2295 2307
2296 free_token(token); 2308 free_token(token);
2297 type = read_token_item(tok); 2309 type = read_token_item(tok);
2298 return type; 2310 return type;
2299 2311
2312 out_free_arg:
2313 free_arg(arg);
2300 out_free: 2314 out_free:
2301 free(arg);
2302 free_token(token); 2315 free_token(token);
2303 *tok = NULL; 2316 *tok = NULL;
2304 return EVENT_ERROR; 2317 return EVENT_ERROR;
@@ -3362,6 +3375,7 @@ process_defined_func(struct trace_seq *s, void *data, int size,
3362 break; 3375 break;
3363 } 3376 }
3364 farg = farg->next; 3377 farg = farg->next;
3378 param = param->next;
3365 } 3379 }
3366 3380
3367 ret = (*func_handle->func)(s, args); 3381 ret = (*func_handle->func)(s, args);
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 2d40c5ed81d6..e08d21ffd3a6 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -325,9 +325,8 @@ static void free_events(struct event_list *events)
325} 325}
326 326
327static struct filter_arg * 327static struct filter_arg *
328create_arg_item(struct event_format *event, 328create_arg_item(struct event_format *event, const char *token,
329 const char *token, enum filter_arg_type type, 329 enum event_type type, char **error_str)
330 char **error_str)
331{ 330{
332 struct format_field *field; 331 struct format_field *field;
333 struct filter_arg *arg; 332 struct filter_arg *arg;