diff options
author | Russell Bryant <russell@russellbryant.com> | 2006-05-11 20:07:44 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2006-05-11 20:07:44 +0000 |
commit | f9c578a8a05beb342a4e02648c35b4b2939d11ba (patch) | |
tree | f91bfa1dc51a7b5350dd534e72ed17e37cdd2b25 /channels/chan_agent.c | |
parent | 126ce7882c857925f24573b4e82fddc888e1ace3 (diff) |
- The recent change to linklists.h broke the build on linux for some reason.
So, I have removed all of the uses of AST_LIST_HEAD_INIT and replaced them
with the equivalent static initializations.
- On passing, fix a memory leak in the unload_module() function of chan_agent.
The agents list mutex was never destroyed, and the elements in the agents
list were not freed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_agent.c')
-rw-r--r-- | channels/chan_agent.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c index c62eaf6d3..94c9cc64c 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -2597,19 +2597,16 @@ static int unload_module(void *mod) ast_manager_unregister("AgentLogoff"); ast_manager_unregister("AgentCallbackLogin"); /* Unregister channel */ - ast_channel_unregister(&agent_tech); - if (!AST_LIST_LOCK(&agents)) { - /* Hangup all interfaces if they have an owner */ - AST_LIST_TRAVERSE(&agents, p, list) { - if (p->owner) - ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD); - } - AST_LIST_UNLOCK(&agents); - AST_LIST_HEAD_INIT(&agents); - } else { - ast_log(LOG_WARNING, "Unable to lock the monitor\n"); - return -1; - } + AST_LIST_LOCK(&agents); + /* Hangup all interfaces if they have an owner */ + while ((p = AST_LIST_REMOVE_HEAD(&agents, list))) { + if (p->owner) + ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD); + free(p); + } + AST_LIST_UNLOCK(&agents); + AST_LIST_HEAD_DESTROY(&agents); + return 0; } |