[asterisk-commits] rizzo: branch rizzo/astobj2 r51283 - /team/rizzo/astobj2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Jan 19 02:09:43 MST 2007


Author: rizzo
Date: Fri Jan 19 03:09:43 2007
New Revision: 51283

URL: http://svn.digium.com/view/asterisk?view=rev&rev=51283
Log:
merge from trunk 51199, (all previous ones already in):

Move the check for a failure of ast_channel_alloc() to before locking the
pvt structure again.  Otherwise, on a failure, this will cause a deadlock.


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=51283&r1=51282&r2=51283
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Jan 19 03:09:43 2007
@@ -1245,7 +1245,7 @@
 		 * waiting for an ack.
 		 */
 
-	REG_STATE_REGISTERED,	/*!< Registred and done */
+	REG_STATE_REGISTERED,	/*!< Registered and done */
 	REG_STATE_REJECTED,	/*!< Registration rejected */
 		/* only used when the remote party has an expire larger than
 		 * our max-expire. This is a final state from which we do not
@@ -4148,11 +4148,11 @@
 		tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "SIP/%s-%08x", my_name, (int)(long) i);
 
 	}
-	sip_pvt_lock(i);
 	if (!tmp) {
 		ast_log(LOG_WARNING, "Unable to allocate AST channel structure for SIP channel\n");
 		return NULL;
 	}
+	sip_pvt_lock(i);
 	tmp->tech = &sip_tech;
 
 	/* Select our native format based on codec preference until we receive



More information about the asterisk-commits mailing list