Fixed core dumps when closing unintialized mongo or sqlite log instances

Fixed a Host header bug in sinqhttpopt
This commit is contained in:
2016-04-08 11:24:02 +02:00
parent 1087dd6c8d
commit 1fb85ef6b5
4 changed files with 16 additions and 11 deletions

View File

@@ -13,7 +13,7 @@
#include <sicsutil.h>
#include <sics.h>
static sqlite3 *db;
static sqlite3 *db = NULL;
static char sqliteFile[1024];
static unsigned int lineCount = 0;
static unsigned int sqlActive = 0;
@@ -23,7 +23,7 @@ static void SqlFlush(void)
{
char *err;
if(sqlActive == 1){
if(sqlActive == 1 && db != NULL){
sqlite3_exec(db,"END TRANSACTION",NULL,NULL,&err);
lineCount = 0;
}
@@ -66,10 +66,12 @@ static void SqlClose(void *data)
{
char *err;
if(sqlActive == 1 && db != NULL){
sqlite3_exec(db,"END TRANSACTION",NULL,NULL,&err);
sqlite3_close(db);
RemoveLogCallback(SqliteCallback);
sqlActive = 0;
}
}
/*------------------------------------------------------------------------------------*/
static int SQLLogConfigAction(SConnection * pCon, SicsInterp * pSics,