[asterisk-commits] russell: branch 1.4 r77780 - /branches/1.4/main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 30 12:29:44 CDT 2007


Author: russell
Date: Mon Jul 30 12:29:43 2007
New Revision: 77780

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77780
Log:
(closes issue #10301)
Reported by: fnordian
Patches:
      asterisk-1.4.9-channel.c.patch uploaded by fnordian (license 110)
      Additional changes by me

Fix some problems in channel_find_locked() which can cause an infinite loop.
The reference to the previous channel is set to NULL in some cases.  These changes
ensure that the reference to the previous channel gets restored before needing
it again.

I'm not convinced that the code that is setting it to NULL is really the right
thing to do.  However, I am making these changes to fix the obvious problem
and just leaving an XXX comment that it needs a better explanation that what
is there now.

Modified:
    branches/1.4/main/channel.c

Modified: branches/1.4/main/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/channel.c?view=diff&rev=77780&r1=77779&r2=77780
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Mon Jul 30 12:29:43 2007
@@ -1034,10 +1034,11 @@
 	struct ast_channel *c;
 	const struct ast_channel *_prev = prev;
 
-	for (retries = 0; retries < 10; retries++) {
+	for (retries = 0; retries < 10; retries++, prev = _prev) {
 		int done;
 		AST_LIST_LOCK(&channels);
 		AST_LIST_TRAVERSE(&channels, c, chan_list) {
+			prev = _prev;
 			if (prev) {	/* look for next item */
 				if (c != prev)	/* not this one */
 					continue;
@@ -1051,6 +1052,7 @@
 				/* We want prev to be NULL in case we end up doing more searching through
 				 * the channel list to find the channel (ie: name searching). If we didn't
 				 * set this to NULL the logic would just blow up
+				 * XXX Need a better explanation for this ...
 				 */
 			}
 			if (name) { /* want match by name */




More information about the asterisk-commits mailing list