diff --git a/include/fluent-bit/flb_scheduler.h b/include/fluent-bit/flb_scheduler.h index 52c72c019d3..c744d01a80f 100644 --- a/include/fluent-bit/flb_scheduler.h +++ b/include/fluent-bit/flb_scheduler.h @@ -127,7 +127,7 @@ int flb_sched_event_handler(struct flb_config *config, struct mk_event *event); struct flb_sched *flb_sched_create(struct flb_config *config, struct mk_event_loop *evl); -int flb_sched_destroy(struct flb_sched *sched); +int flb_sched_destroy(struct mk_event_loop *evl, struct flb_sched *sched); struct flb_sched_timer *flb_sched_timer_create(struct flb_sched *sched); int flb_sched_timer_destroy(struct flb_sched_timer *timer); diff --git a/src/flb_config.c b/src/flb_config.c index 94612cd42bb..9aa38dad756 100644 --- a/src/flb_config.c +++ b/src/flb_config.c @@ -478,7 +478,7 @@ void flb_config_exit(struct flb_config *config) /* Release scheduler */ if (config->sched) { - flb_sched_destroy(config->sched); + flb_sched_destroy(config->evl, config->sched); } #ifdef FLB_HAVE_HTTP_SERVER diff --git a/src/flb_input_thread.c b/src/flb_input_thread.c index bf073296de2..61b6ec77eff 100644 --- a/src/flb_input_thread.c +++ b/src/flb_input_thread.c @@ -457,7 +457,7 @@ static void input_thread(void *data) /* Create the bucket queue (FLB_ENGINE_PRIORITY_COUNT priorities) */ flb_bucket_queue_destroy(evl_bktq); - flb_sched_destroy(sched); + flb_sched_destroy(thi->evl, sched); input_thread_instance_destroy(thi); } diff --git a/src/flb_output_thread.c b/src/flb_output_thread.c index 62cc5a04716..f8af6ab3b99 100644 --- a/src/flb_output_thread.c +++ b/src/flb_output_thread.c @@ -358,7 +358,7 @@ static void output_thread(void *data) flb_upstream_conn_active_destroy_list(&th_ins->upstreams); flb_upstream_conn_pending_destroy_list(&th_ins->upstreams); - flb_sched_destroy(sched); + flb_sched_destroy(th_ins->evl, sched); params = FLB_TLS_GET(out_flush_params); if (params) { flb_free(params); diff --git a/src/flb_scheduler.c b/src/flb_scheduler.c index 7e42550e5c3..82b1629d575 100644 --- a/src/flb_scheduler.c +++ b/src/flb_scheduler.c @@ -575,7 +575,7 @@ struct flb_sched *flb_sched_create(struct flb_config *config, } /* Release all resources used by the Scheduler */ -int flb_sched_destroy(struct flb_sched *sched) +int flb_sched_destroy(struct mk_event_loop *evl, struct flb_sched *sched) { int c = 0; struct mk_list *tmp; @@ -603,6 +603,7 @@ int flb_sched_destroy(struct flb_sched *sched) /* Delete timers */ mk_list_foreach_safe(head, tmp, &sched->timers) { timer = mk_list_entry(head, struct flb_sched_timer, _head); + mk_event_timeout_destroy(evl, &timer->event); flb_sched_timer_destroy(timer); c++; } diff --git a/tests/internal/multiline.c b/tests/internal/multiline.c index e175e1171aa..62fe73b023b 100644 --- a/tests/internal/multiline.c +++ b/tests/internal/multiline.c @@ -1445,7 +1445,7 @@ static void test_issue_5504() TEST_CHECK(ml->last_flush > last_flush); /* Cleanup */ - flb_sched_destroy(config->sched); + flb_sched_destroy(config->evl, config->sched); config->sched = sched; mk_event_loop_destroy(config->evl); config->evl = evl;