diff --git a/bot.c b/bot.c index da09a6f..a6a6db6 100644 --- a/bot.c +++ b/bot.c @@ -74,6 +74,8 @@ tmpChan = botAddChan(row[0]); if (tmpChan == 0x0) return(-1); + + pthread_mutex_lock(&chanMutex); sWriteSocket("JOIN %s",row[0]); sleep(2); @@ -133,7 +135,9 @@ strcpy(tmpChan->topic,row[7]); tmpChan->updated = 1; + pthread_mutex_unlock(&chanMutex); } + mysql_free_result(res); } return(0x0); } diff --git a/thread.c b/thread.c index ea361ef..0a83324 100644 --- a/thread.c +++ b/thread.c @@ -103,7 +103,7 @@ sprintf(qryStr,"UPDATE channels SET updated = 0 WHERE channel = '%s'",row[0]); dbQuery(qryStr,0); } - + mysql_free_result(res); } if (lC == 6) {