summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2019-09-21 00:57:59 +0200
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-09-28 23:13:39 +0200
commit96c5c6e6a5b6db592acae039fed54b5c8844cd35 (patch)
tree70a42fe11bc971e3048624439a8d7c7ef11a9004
parenttracing: Fix clang -Wint-in-bool-context warnings in IF_ASSIGN macro (diff)
downloadlinux-96c5c6e6a5b6db592acae039fed54b5c8844cd35.tar.xz
linux-96c5c6e6a5b6db592acae039fed54b5c8844cd35.zip
tracing: Have error path in predicate_parse() free its allocated memory
In predicate_parse, there is an error path that is not going to out_free instead it returns directly which leads to a memory leak. Link: http://lkml.kernel.org/r/20190920225800.3870-1-navid.emamdoost@gmail.com Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--kernel/trace/trace_events_filter.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index c773b8fb270c..c9a74f82b14a 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -452,8 +452,10 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
switch (*next) {
case '(': /* #2 */
- if (top - op_stack > nr_parens)
- return ERR_PTR(-EINVAL);
+ if (top - op_stack > nr_parens) {
+ ret = -EINVAL;
+ goto out_free;
+ }
*(++top) = invert;
continue;
case '!': /* #3 */