summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2009-11-25 16:32:21 +0800
committerIngo Molnar <mingo@elte.hu>2009-11-27 06:43:04 +0100
commitabab9d37d2a826fcf588c5f30152dbe05c40111c (patch)
treecc4bbdafb5dbf1883d714c1a650c5cc03f83512b /kernel
parent0f1ef51d244809f417bdf45cdb00109fb6005672 (diff)
downloadop-kernel-dev-abab9d37d2a826fcf588c5f30152dbe05c40111c.zip
op-kernel-dev-abab9d37d2a826fcf588c5f30152dbe05c40111c.tar.gz
trace_kprobes: Fix memory leak
tp->nr_args is not set before we "goto error", it causes memory leak for free_trace_probe() use tp->nr_args to free memory of args. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <4B0CEB95.2060107@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_kprobe.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 79ce6a2..82e8583 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -704,10 +704,12 @@ static int create_trace_probe(int argc, char **argv)
ret = parse_probe_arg(arg, &tp->args[i].fetch, is_return);
if (ret) {
pr_info("Parse error at argument%d. (%d)\n", i, ret);
+ kfree(tp->args[i].name);
goto error;
}
+
+ tp->nr_args++;
}
- tp->nr_args = i;
ret = register_trace_probe(tp);
if (ret)
OpenPOWER on IntegriCloud