aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-11 20:07:44 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-11 20:07:44 +0000
commitda3cf563ba87b9cd244f931cfe5c23d17dabafd5 (patch)
treef91bfa1dc51a7b5350dd534e72ed17e37cdd2b25 /channels
parentd681ea85987a742eaa276d37b06ba2052c0a5cd0 (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: http://svn.digium.com/svn/asterisk/trunk@26990 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_agent.c23
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;
}