ignore events on non-initialised log

This commit is contained in:
z3APA3A 2020-10-31 02:18:39 +03:00
parent b3a843aacb
commit ca8788c65f

View File

@ -137,10 +137,12 @@ static void delayflushlogs(void){
void flushlogs(void){ void flushlogs(void){
struct logevent * evt; if(loginit){
evt = malloc(sizeof(struct logevent)); struct logevent * evt;
evt->event = FLUSH; evt = malloc(sizeof(struct logevent));
logpush(evt); evt->event = FLUSH;
logpush(evt);
}
} }
@ -290,6 +292,14 @@ void * logthreadfunc (void *p) {
void logpush(struct logevent *evt){ void logpush(struct logevent *evt){
pthread_mutex_lock(&log_mutex); 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; if(logtail) logtail->next = evt;
logtail = evt; logtail = evt;
evt->next = NULL; evt->next = NULL;