From c69201ebcc6cc382d1ec82f7e6756ff3fc0928ed Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Wed, 18 Sep 2024 14:01:05 +0300 Subject: [PATCH] b2b_logic: prevent crash in case a bridging is in progress --- modules/b2b_logic/bridging.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/b2b_logic/bridging.c b/modules/b2b_logic/bridging.c index 191e1a3f437..c56d2a641a2 100644 --- a/modules/b2b_logic/bridging.c +++ b/modules/b2b_logic/bridging.c @@ -204,15 +204,17 @@ mi_response_t *mi_b2b_bridge(const mi_params_t *params, goto error; } - if (old_entity->peer->peer == old_entity) - old_entity->peer->peer = NULL; - else - { - LM_ERR("Unexpected chain: old_entity=[%p] and old_entity->peer->peer=[%p]\n", - old_entity, old_entity->peer->peer); - goto error; + if (old_entity->peer) { + if (old_entity->peer->peer == old_entity) + old_entity->peer->peer = NULL; + else + { + LM_ERR("Unexpected chain: old_entity=[%p] and old_entity->peer->peer=[%p]\n", + old_entity, old_entity->peer->peer); + goto error; + } + old_entity->peer = NULL; } - old_entity->peer = NULL; tuple->bridge_entities[0]= bridging_entity;