[asterisk-commits] file: branch 12 r404935 - /branches/12/res/res_pjsip_outbound_registration.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jan 5 10:00:18 CST 2014


Author: file
Date: Sun Jan  5 10:00:13 2014
New Revision: 404935

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=404935
Log:
res_pjsip_outbound_registration: Don't assume that a registration client will always exist.

Modified:
    branches/12/res/res_pjsip_outbound_registration.c

Modified: branches/12/res/res_pjsip_outbound_registration.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_outbound_registration.c?view=diff&rev=404935&r1=404934&r2=404935
==============================================================================
--- branches/12/res/res_pjsip_outbound_registration.c (original)
+++ branches/12/res/res_pjsip_outbound_registration.c Sun Jan  5 10:00:13 2014
@@ -311,27 +311,30 @@
 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 (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);
-		}
-	}
-
-	pjsip_regc_destroy(client_state->client);
+	if (client_state->client) {
+		pjsip_regc_info info;
+
+		pjsip_regc_get_info(client_state->client, &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;
+		}
+
+		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);
+			}
+		}
+
+		pjsip_regc_destroy(client_state->client);
+	}
 
 	client_state->status = SIP_REGISTRATION_STOPPED;
 	ast_sip_auth_array_destroy(&client_state->outbound_auths);




More information about the asterisk-commits mailing list