Просмотр исходного кода

siptrace: safety check if db connection is set

- reported in GH #262
Daniel-Constantin Mierla 10 лет назад
Родитель
Сommit
740cfa0ebe
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      modules/siptrace/siptrace.c

+ 5 - 0
modules/siptrace/siptrace.c

@@ -757,6 +757,11 @@ static int sip_trace_store(struct _siptrace_data *sto, struct dest_info *dst)
 
 
 static int sip_trace_store_db(struct _siptrace_data *sto)
 static int sip_trace_store_db(struct _siptrace_data *sto)
 {
 {
+	if(db_con==NULL) {
+		LM_DBG("database connection not initialized\n");
+		return -1;
+	}
+
 	if(trace_to_database_flag==NULL || *trace_to_database_flag==0)
 	if(trace_to_database_flag==NULL || *trace_to_database_flag==0)
 		goto done;
 		goto done;