From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> 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. Fixes: e50d3bbfc9a4 ("kernel-shark: Add sched_waking event processing to sched_waking") Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> --- kernel-shark/src/plugins/sched_events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"); -- 2.20.1
![]() |