瀏覽代碼

siptrace: safety check if db connection is set

- reported in GH #262
Daniel-Constantin Mierla 10 年之前
父節點
當前提交
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)
 {
+	if(db_con==NULL) {
+		LM_DBG("database connection not initialized\n");
+		return -1;
+	}
+
 	if(trace_to_database_flag==NULL || *trace_to_database_flag==0)
 		goto done;