[sr-dev] git:master:a0b2e58c: Merge pull request #198 from adubovikov/master

Alexandr Dubovikov alexandr.dubovikov at gmail.com
Tue Jun 9 23:34:17 CEST 2015


Module: kamailio
Branch: master
Commit: a0b2e58ce34647f2d33d77fb51f50a67541b9224
URL: https://github.com/kamailio/kamailio/commit/a0b2e58ce34647f2d33d77fb51f50a67541b9224

Author: Alexandr Dubovikov <alexandr.dubovikov at gmail.com>
Committer: Alexandr Dubovikov <alexandr.dubovikov at gmail.com>
Date: 2015-06-09T23:34:12+02:00

Merge pull request #198 from adubovikov/master

modules/sipcapture: fixed empty table parameter. Update sipcapture.c

---

Modified: modules/sipcapture/sipcapture.c

---

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

---

diff --git a/modules/sipcapture/sipcapture.c b/modules/sipcapture/sipcapture.c
index 6563d8b..db3da65 100644
--- a/modules/sipcapture/sipcapture.c
+++ b/modules/sipcapture/sipcapture.c
@@ -1187,14 +1187,14 @@ static int sip_capture_store(struct _sipcapture_object *sco, str *dtable, _captu
 	db_key_t db_keys[NR_KEYS];
 	db_val_t db_vals[NR_KEYS];
 
-	str tmp, corrtmp;
+	str tmp, corrtmp, ntab;
 	int ii = 0;
 	int ret = 0;
 	int counter = 0;
 	db_insert_f insert;
 	time_t retry_failed_time = 0;
 	struct tm capt_ts;
-	
+ 
 	/* new */
 	str *table = NULL;
 	_capture_mode_data_t *c = NULL;
@@ -1435,11 +1435,9 @@ static int sip_capture_store(struct _sipcapture_object *sco, str *dtable, _captu
 		table = &c->table_names[ii];
 	}
 	else {
-	        table->s = table_name.s;
-	        table->len = table_name.len;
+	        table = &table_name;
 	}
 
-        
 	tvsec_ = (time_t) (sco->tmstamp/1000000);        		
 	if(gmtime_r( &tvsec_, &capt_ts) == NULL)
         {
@@ -1447,9 +1445,11 @@ static int sip_capture_store(struct _sipcapture_object *sco, str *dtable, _captu
                 return -1;
         }
 
-        table->len = strftime(strftime_buf, sizeof(strftime_buf), table->s,  &capt_ts);
-        table->s = strftime_buf;
-	
+    	ntab.len = strftime(strftime_buf, sizeof(strftime_buf), table->s,  &capt_ts);
+        ntab.s = strftime_buf;
+
+        table = &ntab;
+
 	/* check dynamic table */
 	LM_DBG("insert into homer table [1]: [%.*s]\n", table->len, table->s);
 	c->db_funcs.use_table(c->db_con, table);




More information about the sr-dev mailing list