From c7780dbd78a2192178694283da982dee84b9f80b Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Fri, 13 Sep 2024 12:20:34 +0300 Subject: [PATCH] b2b_entitites: do not unref cancelled cell if not ours If a CANCEL is caught by the b2b_entities but it is not part of a b2b dialog, it should not unref the cell, otherwise after the script is executed, it will be unreffed again, leading to a double unref. Many thanks to Voxtronic for spotting this issue! --- modules/b2b_entities/dlg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/b2b_entities/dlg.c b/modules/b2b_entities/dlg.c index 7e1985defec..3c140992db0 100644 --- a/modules/b2b_entities/dlg.c +++ b/modules/b2b_entities/dlg.c @@ -885,13 +885,14 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam) */ dlg = b2bl_search_iteratively(&callid, &from_tag, T_invite, hash_index); - tmb.unref_cell( T_invite ); if(dlg == NULL) { B2BE_LOCK_RELEASE(server_htable, hash_index); LM_DBG("No dialog found for cancel\n"); return SCB_RUN_ALL; } + tmb.unref_cell( T_invite ); + reset_cancelled_t(); ctx = b2b_get_context(); if (!ctx) {