aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-30 17:31:29 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-30 17:31:29 +0000
commite50f9106f41376106f12e4e7f3b884d6e151188b (patch)
tree5061a58c4a8a9d877d19092594eeb514cf32b1e5 /main
parent5e9bdafd34a5010171e6a9cdddcf5fd19499b93e (diff)
Merged revisions 77780 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r77780 | russell | 2007-07-30 12:29:43 -0500 (Mon, 30 Jul 2007) | 16 lines (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. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@77781 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/channel.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c
index bc6041348..e1595bddf 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -931,10 +931,11 @@ static struct ast_channel *channel_find_locked(const struct ast_channel *prev,
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_RWLIST_RDLOCK(&channels);
AST_RWLIST_TRAVERSE(&channels, c, chan_list) {
+ prev = _prev;
if (prev) { /* look for next item */
if (c != prev) /* not this one */
continue;
@@ -948,6 +949,7 @@ static struct ast_channel *channel_find_locked(const struct ast_channel *prev,
/* 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 */