kernel-shark: sched-plugin: Initialize plugin_sched_context_handler to zeros
Now that the sched plugin only requires a single wakeup event to process the
wakeup latency boxes, there's no guarantee that all the wakeup events saved
in plugin_sched_context_handler will be initialized.
Allocate plugin_sched_context_handler to zeros with calloc() instead of
malloc() to make sure the pointers it has are NULL and not left
uninitialized.
Reviewed-by: Yordan Karadzhov <ykaradzhov@vmware.com>
Fixes: e50d3bbfc9a4 ("kernel-shark: Add sched_waking event processing to sched_waking")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
diff --git a/kernel-shark/src/plugins/sched_events.c b/kernel-shark/src/plugins/sched_events.c
index 14f8edb..68734d4 100644
--- a/kernel-shark/src/plugins/sched_events.c
+++ b/kernel-shark/src/plugins/sched_events.c
@@ -49,7 +49,7 @@
assert(plugin_sched_context_handler == NULL);
plugin_sched_context_handler =
- malloc(sizeof(*plugin_sched_context_handler));
+ calloc(1, sizeof(*plugin_sched_context_handler));
if (!plugin_sched_context_handler) {
fprintf(stderr,
"Failed to allocate memory for plugin_sched_context.\n");