From ca8788c65f14cf5ca493ec7ba49030f7568c44af Mon Sep 17 00:00:00 2001 From: z3APA3A <3APA3A@3proxy.ru> Date: Sat, 31 Oct 2020 02:18:39 +0300 Subject: [PATCH] ignore events on non-initialised log --- src/log.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/log.c b/src/log.c index 164ae24..9cf51be 100644 --- a/src/log.c +++ b/src/log.c @@ -137,10 +137,12 @@ static void delayflushlogs(void){ void flushlogs(void){ - struct logevent * evt; - evt = malloc(sizeof(struct logevent)); - evt->event = FLUSH; - logpush(evt); + if(loginit){ + struct logevent * evt; + evt = malloc(sizeof(struct logevent)); + evt->event = FLUSH; + logpush(evt); + } } @@ -290,6 +292,14 @@ void * logthreadfunc (void *p) { void logpush(struct logevent *evt){ pthread_mutex_lock(&log_mutex); + if(!loginit){ + if(evt->event == FREEPARAM){ + delayfreeparam(evt->param); + } + myfree(evt); + pthread_mutex_unlock(&log_mutex); + return; + } if(logtail) logtail->next = evt; logtail = evt; evt->next = NULL;