aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-06 16:55:59 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-06 16:55:59 +0000
commit410867c294e190ce9d0b563cb4fe4232b86ed097 (patch)
tree5858438bc012dcbd704e1cb948c62f6470951c3a /main
parent566b73cd51f733bdc27ebaa31deab8a233bfc3fb (diff)
Merged revisions 67715 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r67715 | russell | 2007-06-06 11:40:51 -0500 (Wed, 06 Jun 2007) | 5 lines We have some bug reports showing crashes due to a double free of a channel. Add a sanity check to ast_channel_free() to make sure we don't go on trying to free a channel that wasn't found in the channel list. (issue #8850, and others...) ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@67716 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/channel.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c
index 71c1e0a44..5063e5f23 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1176,7 +1176,10 @@ void ast_channel_free(struct ast_channel *chan)
headp=&chan->varshead;
AST_LIST_LOCK(&channels);
- AST_LIST_REMOVE(&channels, chan, chan_list);
+ if (!AST_LIST_REMOVE(&channels, chan, chan_list)) {
+ AST_LIST_UNLOCK(&channels);
+ ast_log(LOG_ERROR, "Unable to find channel in list to free. Assuming it has already been done.\n");
+ }
/* Lock and unlock the channel just to be sure nobody
has it locked still */
ast_channel_lock(chan);