[asterisk-commits] russell: branch 1.4 r105570 - /branches/1.4/channels/chan_local.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 3 11:16:53 CST 2008


Author: russell
Date: Mon Mar  3 11:16:53 2008
New Revision: 105570

URL: http://svn.digium.com/view/asterisk?view=rev&rev=105570
Log:
In the case of an ast_channel allocation failure, take the local_pvt out of the
pvt list before destroying it.

Modified:
    branches/1.4/channels/chan_local.c

Modified: branches/1.4/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_local.c?view=diff&rev=105570&r1=105569&r2=105570
==============================================================================
--- branches/1.4/channels/chan_local.c (original)
+++ branches/1.4/channels/chan_local.c Mon Mar  3 11:16:53 2008
@@ -150,6 +150,9 @@
 		return AST_DEVICE_UNKNOWN;
 }
 
+/*!
+ * \note Assumes the pvt is no longer in the pvts list
+ */
 static struct local_pvt *local_pvt_destroy(struct local_pvt *pvt)
 {
 	ast_mutex_destroy(&pvt->lock);
@@ -673,8 +676,12 @@
 
 	/* Allocate a new private structure and then Asterisk channel */
 	if ((p = local_alloc(data, format))) {
-		if (!(chan = local_new(p, AST_STATE_DOWN)))
+		if (!(chan = local_new(p, AST_STATE_DOWN))) {
+			AST_LIST_LOCK(&locals);
+			AST_LIST_REMOVE(&locals, p, list);
+			AST_LIST_UNLOCK(&locals);
 			p = local_pvt_destroy(p);
+		}
 	}
 
 	return chan;




More information about the asterisk-commits mailing list