Skip to content

Commit

Permalink
log: free log worker pipe when appropriate.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan committed Jan 18, 2024
1 parent 71746b3 commit a0e5129
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/fluent-bit/flb_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ static inline int flb_log_suppress_check(int log_suppress_interval, const char *
#endif

int flb_log_worker_init(struct flb_worker *worker);
int flb_log_worker_destroy(struct flb_worker *worker);
int flb_errno_print(int errnum, const char *file, int line);

#ifdef __FLB_FILENAME__
Expand Down
7 changes: 7 additions & 0 deletions src/flb_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ int flb_log_cache_check_suppress(struct flb_log_cache *cache, char *msg_buf, siz
return FLB_TRUE;
}

int flb_log_worker_destroy(struct flb_worker *worker)
{
flb_pipe_destroy(worker->log);
return 0;
}

int flb_log_worker_init(struct flb_worker *worker)
{
int ret;
Expand Down Expand Up @@ -689,6 +695,7 @@ int flb_log_destroy(struct flb_log *log, struct flb_config *config)
if (log->worker->log_cache) {
flb_log_cache_destroy(log->worker->log_cache);
}
flb_log_worker_destroy(log->worker);
flb_free(log->worker);
flb_free(log);

Expand Down
4 changes: 1 addition & 3 deletions src/flb_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ void flb_worker_destroy(struct flb_worker *worker)
return;
}

if (worker->log_cache) {
flb_log_cache_destroy(worker->log_cache);
}
flb_log_worker_destroy(worker);

mk_list_del(&worker->_head);
flb_free(worker);
Expand Down

0 comments on commit a0e5129

Please sign in to comment.