[sr-dev] git:5.2:94b60464: siptrace: check if trace_to_database is set before checking the db connection

Federico Cabiddu federico.cabiddu at gmail.com
Tue Aug 27 09:28:07 CEST 2019


Module: kamailio
Branch: 5.2
Commit: 94b60464c9ccac49ebae238aa42ae16fb2c5f9ec
URL: https://github.com/kamailio/kamailio/commit/94b60464c9ccac49ebae238aa42ae16fb2c5f9ec

Author: Federico Cabiddu <federico.cabiddu at gmail.com>
Committer: Federico Cabiddu <federico.cabiddu at gmail.com>
Date: 2019-08-27T09:27:54+02:00

siptrace: check if trace_to_database is set before checking the db connection

(cherry picked from commit afd0c929dc72a975e2ca3c88f307fd8c140a4fda)

---

Modified: src/modules/siptrace/siptrace.c

---

Diff:  https://github.com/kamailio/kamailio/commit/94b60464c9ccac49ebae238aa42ae16fb2c5f9ec.diff
Patch: https://github.com/kamailio/kamailio/commit/94b60464c9ccac49ebae238aa42ae16fb2c5f9ec.patch

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 08ddc07ef5..a5299d4cad 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -497,14 +497,14 @@ static int sip_trace_store(siptrace_data_t *sto, dest_info_t *dst,
 
 static int sip_trace_store_db(siptrace_data_t *sto)
 {
+	if(trace_to_database_flag == NULL || *trace_to_database_flag == 0)
+		goto done;
+
 	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;
-
 	db_key_t db_keys[NR_KEYS];
 	db_val_t db_vals[NR_KEYS];
 




More information about the sr-dev mailing list