aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2019-02-14 10:51:17 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-02-14 12:22:23 -0500
commit1784290dba09e2606775d6a73bafdd2c4e16cd5a (patch)
treece973742e6e2d15ad57a31ddbb89da98257a304b
parent50da1589ec71a5ddf2e757f52ba1dd1b276ce38e (diff)
downloadtrace-cmd-1784290dba09e2606775d6a73bafdd2c4e16cd5a.tar.gz
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>
-rw-r--r--kernel-shark/src/plugins/sched_events.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel-shark/src/plugins/sched_events.c b/kernel-shark/src/plugins/sched_events.c
index 14f8edb2..68734d4d 100644
--- a/kernel-shark/src/plugins/sched_events.c
+++ b/kernel-shark/src/plugins/sched_events.c
@@ -49,7 +49,7 @@ static bool plugin_sched_init_context(struct kshark_context *kshark_ctx)
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");