Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/fluent-bit/flb_scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,14 @@ struct flb_sched_timer_coro {
struct cfl_list _head;
};

#define FLB_SCHED_TLS_MAGIC 0x53544350u

/* parameter for timer callback running under a co-routine */
struct flb_sched_timer_coro_cb_params {
struct flb_sched_timer_coro *stc;
struct flb_config *config;
void *data;
uint32_t magic;
struct flb_coro *coro;
};

Expand Down Expand Up @@ -259,6 +262,7 @@ static FLB_INLINE void sched_timer_cb_params_set(struct flb_sched_timer_coro *st
params->config = config;
params->data = data;
params->coro = coro;
params->magic = FLB_SCHED_TLS_MAGIC;

FLB_TLS_SET(sched_timer_coro_cb_params, params);
co_switch(coro->callee);
Expand Down
2 changes: 1 addition & 1 deletion src/flb_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ int flb_engine_shutdown(struct flb_config *config)

/* scheduler */
sched_params = (struct flb_sched_timer_coro_cb_params *) FLB_TLS_GET(sched_timer_coro_cb_params);
if (sched_params != NULL) {
if (sched_params && sched_params->magic == FLB_SCHED_TLS_MAGIC) {
flb_free(sched_params);
FLB_TLS_SET(sched_timer_coro_cb_params, NULL);
}
Expand Down
2 changes: 1 addition & 1 deletion src/flb_output_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ static void output_thread(void *data)
}

sched_params = (struct flb_sched_timer_coro_cb_params *) FLB_TLS_GET(sched_timer_coro_cb_params);
if (sched_params != NULL) {
if (sched_params != NULL && sched_params->magic == FLB_SCHED_TLS_MAGIC) {
flb_free(sched_params);
FLB_TLS_SET(sched_timer_coro_cb_params, NULL);
}
Expand Down
Loading