From 138a552ce71c795f39ad6e35d815d182dc26e747 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Wed, 25 Nov 2015 14:10:32 +0100 Subject: [PATCH] cnxcc: more safety checks for call structure (cherry picked from commit 6985a2953b0577ad8dff449c2e849f6ff15da01c) --- modules/cnxcc/cnxcc_mod.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/cnxcc/cnxcc_mod.c b/modules/cnxcc/cnxcc_mod.c index f24e8bd2040..456d497d385 100644 --- a/modules/cnxcc/cnxcc_mod.c +++ b/modules/cnxcc/cnxcc_mod.c @@ -889,14 +889,18 @@ void terminate_all_calls(credit_data_t *credit_data) { credit_data->deallocating = 1; clist_foreach_safe(credit_data->call_list, call, tmp, next) { - LM_DBG("Killing call with CID [%.*s]\n", call->sip_data.callid.len, call->sip_data.callid.s); - - /* - * Update number of calls forced to end - */ - _data.stats->dropped++; - terminate_call(call); - __free_call(call); + if(call->sip_data.callid.s!=NULL) { + LM_DBG("Killing call with CID [%.*s]\n", call->sip_data.callid.len, call->sip_data.callid.s); + + /* + * Update number of calls forced to end + */ + _data.stats->dropped++; + terminate_call(call); + __free_call(call); + } else { + LM_WARN("invalid call structure %p\n", call); + } } }