From 797f19d4cd98985e45afc802087ad888fc2c6f4d Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Tue, 8 Feb 2022 15:52:15 +0100 Subject: [PATCH] sys/event/callback: in init set list_node.next to NULL When using static initializers uninitialized fields are set to 0, or NULL for pointers. But when using event_callback_init() on non static variables event_callback_t structure may hold non 0 values. This will lead to the event never being called since if super.list_node.next is not NULL as it is considered already in the event queue and therefore not touched. --- sys/event/callback.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/event/callback.c b/sys/event/callback.c index 5acb5fd3cd..3f6a5f2bc3 100644 --- a/sys/event/callback.c +++ b/sys/event/callback.c @@ -18,6 +18,7 @@ void _event_callback_handler(event_t *event) void event_callback_init(event_callback_t *event_callback, void (callback)(void *), void *arg) { + memset(event_callback, 0, sizeof(*event_callback)); event_callback->super.handler = _event_callback_handler; event_callback->callback = callback; event_callback->arg = arg;