From 2e9ecd1cce9b27126b30cd5c84e0aee75cd939c5 Mon Sep 17 00:00:00 2001 From: Antonio Silva Date: Wed, 23 Oct 2024 15:18:31 +0100 Subject: [PATCH] mod_verto: fix segfault in verto bye --- src/mod/endpoints/mod_verto/mod_verto.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 48c40527b56..531bcbe12d4 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3076,9 +3076,11 @@ static switch_bool_t verto__bye_func(const char *method, cJSON *params, jsock_t if ((session = switch_core_session_locate(call_id))) { verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY); - tech_pvt->remote_hangup_cause = cause; - switch_channel_set_variable(tech_pvt->channel, "verto_hangup_disposition", "recv_bye"); - switch_channel_hangup(tech_pvt->channel, cause); + if (tech_pvt) { + tech_pvt->remote_hangup_cause = cause; + switch_channel_set_variable(tech_pvt->channel, "verto_hangup_disposition", "recv_bye"); + switch_channel_hangup(tech_pvt->channel, cause); + } cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CALL ENDED")); cJSON_AddItemToObject(obj, "causeCode", cJSON_CreateNumber(cause));