Browse code

tsilo: init and safety check for t value before unref

Daniel-Constantin Mierla authored on 29/12/2015 22:48:39
Showing 1 changed files
... ...
@@ -82,7 +82,7 @@ int ts_append(struct sip_msg* msg, str *ruri, char *table) {
82 82
 }
83 83
 
84 84
 int ts_append_to(struct sip_msg* msg, int tindex, int tlabel, char *table, str *uri) {
85
-	struct cell     *t;
85
+	struct cell     *t=0;
86 86
 	struct cell     *orig_t;
87 87
 	struct sip_msg *orig_msg;
88 88
 	int ret;
... ...
@@ -130,7 +130,7 @@ int ts_append_to(struct sip_msg* msg, int tindex, int tlabel, char *table, str *
130 130
 done:
131 131
 	/* unref the transaction which had been referred by t_lookup_ident() call. 
132 132
 	 * Restore the original transaction (if any) */
133
-	_tmb.unref_cell(t);
133
+	if(t) _tmb.unref_cell(t);
134 134
 	_tmb.t_sett(orig_t, T_BR_UNDEFINED);
135 135
 	
136 136
 	return ret;