From 986c9e897de46c88b4bfec385151ffc00d6bb228 Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Sun, 5 Jan 2014 16:01:53 +0000 Subject: [PATCH] res_pjsip_outbound_registration: Don't assume that a registration client will always exist. ........ Merged revisions 404935 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404936 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_pjsip_outbound_registration.c | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c index b9429d36a1..63f34a014d 100644 --- a/res/res_pjsip_outbound_registration.c +++ b/res/res_pjsip_outbound_registration.c @@ -307,27 +307,30 @@ static void schedule_registration(struct sip_outbound_registration_client_state static int handle_client_state_destruction(void *data) { RAII_VAR(struct sip_outbound_registration_client_state *, client_state, data, ao2_cleanup); - pjsip_regc_info info; cancel_registration(client_state); - pjsip_regc_get_info(client_state->client, &info); + if (client_state->client) { + pjsip_regc_info info; - if (info.is_busy == PJ_TRUE) { - /* If a client transaction is in progress we defer until it is complete */ - client_state->destroy = 1; - return 0; - } + pjsip_regc_get_info(client_state->client, &info); - if (client_state->status != SIP_REGISTRATION_UNREGISTERED && client_state->status != SIP_REGISTRATION_REJECTED_PERMANENT) { - pjsip_tx_data *tdata; + if (info.is_busy == PJ_TRUE) { + /* If a client transaction is in progress we defer until it is complete */ + client_state->destroy = 1; + return 0; + } + + if (client_state->status != SIP_REGISTRATION_UNREGISTERED && client_state->status != SIP_REGISTRATION_REJECTED_PERMANENT) { + pjsip_tx_data *tdata; - if (pjsip_regc_unregister(client_state->client, &tdata) == PJ_SUCCESS) { - pjsip_regc_send(client_state->client, tdata); + if (pjsip_regc_unregister(client_state->client, &tdata) == PJ_SUCCESS) { + pjsip_regc_send(client_state->client, tdata); + } } - } - pjsip_regc_destroy(client_state->client); + pjsip_regc_destroy(client_state->client); + } client_state->status = SIP_REGISTRATION_STOPPED; ast_sip_auth_vector_destroy(&client_state->outbound_auths); -- 2.47.2