[asterisk-commits] branch 1.2 - r8588 /branches/1.2/channel.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jan 24 15:32:10 MST 2006


Author: kpfleming
Date: Tue Jan 24 16:32:09 2006
New Revision: 8588

URL: http://svn.digium.com/view/asterisk?rev=8588&view=rev
Log:
ensure that channel cannot become zombie after we check but before we try to start indications

Modified:
    branches/1.2/channel.c

Modified: branches/1.2/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channel.c?rev=8588&r1=8587&r2=8588&view=diff
==============================================================================
--- branches/1.2/channel.c (original)
+++ branches/1.2/channel.c Tue Jan 24 16:32:09 2006
@@ -2005,10 +2005,12 @@
 {
 	int res = -1;
 
+	ast_mutex_lock(&chan->lock);
 	/* Stop if we're a zombie or need a soft hangup */
-	if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) 
+	if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
+		ast_mutex_unlock(&chan->lock);
 		return -1;
-	ast_mutex_lock(&chan->lock);
+	}
 	if (chan->tech->indicate)
 		res = chan->tech->indicate(chan, condition);
 	ast_mutex_unlock(&chan->lock);



More information about the asterisk-commits mailing list