- 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
This commit is contained in:
Russell Bryant
2006-05-11 20:07:44 +00:00
parent 126ce7882c
commit f9c578a8a0
6 changed files with 18 additions and 39 deletions

View File

@@ -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;
}