From: Russell Bryant Date: Wed, 17 Jan 2007 21:18:35 +0000 (+0000) Subject: Merged revisions 51197 via svnmerge from X-Git-Tag: 1.4.1~263 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4244459e315a59e1af65d1a29dc565859ebd12f8;p=thirdparty%2Fasterisk.git Merged revisions 51197 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r51197 | russell | 2007-01-17 15:17:21 -0600 (Wed, 17 Jan 2007) | 3 lines 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. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@51198 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 2e7107d137..5b5c6aeb5a 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3735,11 +3735,11 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "SIP/%s-%08x", my_name, (int)(long) i); } - ast_mutex_lock(&i->lock); if (!tmp) { ast_log(LOG_WARNING, "Unable to allocate AST channel structure for SIP channel\n"); return NULL; } + ast_mutex_lock(&i->lock); tmp->tech = &sip_tech; /* Select our native format based on codec preference until we receive