diff --git a/components/esp_event/esp_event.c b/components/esp_event/esp_event.c index be55d952f5..a346d2f348 100644 --- a/components/esp_event/esp_event.c +++ b/components/esp_event/esp_event.c @@ -678,15 +678,15 @@ esp_err_t esp_event_handler_register_with(esp_event_loop_handle_t event_loop, es (last_loop_node && !SLIST_EMPTY(&(last_loop_node->base_nodes)) && is_loop_level_handler)) { loop_node = (esp_event_loop_node_t*) calloc(1, sizeof(*loop_node)); - SLIST_INIT(&(loop_node->handlers)); - SLIST_INIT(&(loop_node->base_nodes)); - if (!loop_node) { ESP_LOGE(TAG, "alloc for new loop node failed"); err = ESP_ERR_NO_MEM; goto on_err; } + SLIST_INIT(&(loop_node->handlers)); + SLIST_INIT(&(loop_node->base_nodes)); + err = loop_node_add_handler(loop_node, event_base, event_id, event_handler, event_handler_arg); if (err == ESP_OK) {