[asterisk-commits] russell: trunk r105571 - in /trunk: ./ channels/chan_local.c

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


Author: russell
Date: Mon Mar  3 11:17:27 2008
New Revision: 105571

URL: http://svn.digium.com/view/asterisk?view=rev&rev=105571
Log:
Merged revisions 105570 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105570 | russell | 2008-03-03 11:16:53 -0600 (Mon, 03 Mar 2008) | 3 lines

In the case of an ast_channel allocation failure, take the local_pvt out of the
pvt list before destroying it.

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_local.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_local.c?view=diff&rev=105571&r1=105570&r2=105571
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Mon Mar  3 11:17:27 2008
@@ -157,6 +157,9 @@
 	return res;
 }
 
+/*!
+ * \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);
@@ -693,8 +696,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