Browse code

cnxcc: more safety checks for call structure

Daniel-Constantin Mierla authored on 25/11/2015 13:10:32
Showing 1 changed files
... ...
@@ -889,14 +889,18 @@ void terminate_all_calls(credit_data_t *credit_data) {
889 889
 	credit_data->deallocating = 1;
890 890
 
891 891
 	clist_foreach_safe(credit_data->call_list, call, tmp, next) {
892
-		LM_DBG("Killing call with CID [%.*s]\n", call->sip_data.callid.len, call->sip_data.callid.s);
893
-
894
-		/*
895
-		 * Update number of calls forced to end
896
-		 */
897
-		_data.stats->dropped++;
898
-		terminate_call(call);
899
-		__free_call(call);
892
+		if(call->sip_data.callid.s!=NULL) {
893
+			LM_DBG("Killing call with CID [%.*s]\n", call->sip_data.callid.len, call->sip_data.callid.s);
894
+
895
+			/*
896
+			 * Update number of calls forced to end
897
+			 */
898
+			_data.stats->dropped++;
899
+			terminate_call(call);
900
+			__free_call(call);
901
+		} else {
902
+			LM_WARN("invalid call structure %p\n", call);
903
+		}
900 904
 	}
901 905
 }
902 906