From: Joshua Colp Date: Sun, 5 Jan 2014 16:00:13 +0000 (+0000) Subject: res_pjsip_outbound_registration: Don't assume that a registration client will always... X-Git-Tag: 12.1.0-rc1~3^2~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92caf5de28a85509ddfddfa89ecbf244c7579796;p=thirdparty%2Fasterisk.git res_pjsip_outbound_registration: Don't assume that a registration client will always exist. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@404935 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c index 0623157302..0607076088 100644 --- a/res/res_pjsip_outbound_registration.c +++ b/res/res_pjsip_outbound_registration.c @@ -311,27 +311,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_array_destroy(&client_state->outbound_auths);