aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_events.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-05-05 22:33:04 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-06 04:38:19 -0400
commit2df75e415709ad12862028916c772c1f377f6a7c (patch)
tree3374a78cb06fe096e82d9e4d03ad03d048784967 /kernel/trace/trace_events.c
parent96d17980fabeb757706d2d6db5a28580a6156bfc (diff)
tracing/events: fix memory leak when unloading module
When unloading a module, memory allocated by init_preds() and trace_define_field() is not freed. [ Impact: fix memory leak ] Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <4A00F6E0.3040503@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r--kernel/trace/trace_events.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index f789ca540fe1..f251a150e75e 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -60,6 +60,22 @@ err:
60} 60}
61EXPORT_SYMBOL_GPL(trace_define_field); 61EXPORT_SYMBOL_GPL(trace_define_field);
62 62
63#ifdef CONFIG_MODULES
64
65static void trace_destroy_fields(struct ftrace_event_call *call)
66{
67 struct ftrace_event_field *field, *next;
68
69 list_for_each_entry_safe(field, next, &call->fields, link) {
70 list_del(&field->link);
71 kfree(field->type);
72 kfree(field->name);
73 kfree(field);
74 }
75}
76
77#endif /* CONFIG_MODULES */
78
63static void ftrace_clear_events(void) 79static void ftrace_clear_events(void)
64{ 80{
65 struct ftrace_event_call *call; 81 struct ftrace_event_call *call;
@@ -925,6 +941,8 @@ static void trace_module_remove_events(struct module *mod)
925 unregister_ftrace_event(call->event); 941 unregister_ftrace_event(call->event);
926 debugfs_remove_recursive(call->dir); 942 debugfs_remove_recursive(call->dir);
927 list_del(&call->list); 943 list_del(&call->list);
944 trace_destroy_fields(call);
945 destroy_preds(call);
928 } 946 }
929 } 947 }
930 948