mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
tracing/filters: Always free pred on filter_add_subsystem_pred() failure
If filter_add_subsystem_pred() fails due to ENOSPC or ENOMEM, the pred doesn't get freed, while as a side effect it does for other errors. Make it so the caller always frees the pred for any error. Signed-off-by: Tom Zanussi <tzanussi@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Li Zefan <lizf@cn.fujitsu.com> LKML-Reference: <1249746593.6453.32.camel@tropicana> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
96b2de313b
commit
26528e773e
1 changed files with 11 additions and 5 deletions
|
@ -624,9 +624,6 @@ static int filter_add_subsystem_pred(struct filter_parse_state *ps,
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
filter->preds[filter->n_preds] = pred;
|
|
||||||
filter->n_preds++;
|
|
||||||
|
|
||||||
list_for_each_entry(call, &ftrace_events, list) {
|
list_for_each_entry(call, &ftrace_events, list) {
|
||||||
|
|
||||||
if (!call->define_fields)
|
if (!call->define_fields)
|
||||||
|
@ -643,6 +640,9 @@ static int filter_add_subsystem_pred(struct filter_parse_state *ps,
|
||||||
}
|
}
|
||||||
replace_filter_string(call->filter, filter_string);
|
replace_filter_string(call->filter, filter_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filter->preds[filter->n_preds] = pred;
|
||||||
|
filter->n_preds++;
|
||||||
out:
|
out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -1034,9 +1034,12 @@ static int replace_preds(struct event_subsystem *system,
|
||||||
if (call) {
|
if (call) {
|
||||||
err = filter_add_pred(ps, call, pred);
|
err = filter_add_pred(ps, call, pred);
|
||||||
filter_free_pred(pred);
|
filter_free_pred(pred);
|
||||||
} else
|
} else {
|
||||||
err = filter_add_subsystem_pred(ps, system,
|
err = filter_add_subsystem_pred(ps, system,
|
||||||
pred, filter_string);
|
pred, filter_string);
|
||||||
|
if (err)
|
||||||
|
filter_free_pred(pred);
|
||||||
|
}
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -1055,9 +1058,12 @@ static int replace_preds(struct event_subsystem *system,
|
||||||
if (call) {
|
if (call) {
|
||||||
err = filter_add_pred(ps, call, pred);
|
err = filter_add_pred(ps, call, pred);
|
||||||
filter_free_pred(pred);
|
filter_free_pred(pred);
|
||||||
} else
|
} else {
|
||||||
err = filter_add_subsystem_pred(ps, system, pred,
|
err = filter_add_subsystem_pred(ps, system, pred,
|
||||||
filter_string);
|
filter_string);
|
||||||
|
if (err)
|
||||||
|
filter_free_pred(pred);
|
||||||
|
}
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue