Merged revisions 135479 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r135479 | tilghman | 2008-08-04 11:56:19 -0500 (Mon, 04 Aug 2008) | 6 lines Memory leak on unload (closes issue #13231) Reported by: eliel Patches: app_voicemail.leak.patch uploaded by eliel (license 64) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@135480 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
d328d088cf
commit
cc8c23c149
|
@ -9557,10 +9557,31 @@ static int manager_list_voicemail_users(struct mansession *s, const struct messa
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
/*! \brief Free the users structure. */
|
||||
static void free_vm_users(void)
|
||||
{
|
||||
struct ast_vm_user *cur;
|
||||
AST_LIST_LOCK(&users);
|
||||
while ((cur = AST_LIST_REMOVE_HEAD(&users, list))) {
|
||||
ast_set_flag(cur, VM_ALLOCED);
|
||||
free_user(cur);
|
||||
}
|
||||
AST_LIST_UNLOCK(&users);
|
||||
}
|
||||
|
||||
/*! \brief Free the zones structure. */
|
||||
static void free_vm_zones(void)
|
||||
{
|
||||
struct vm_zone *zcur;
|
||||
AST_LIST_LOCK(&zones);
|
||||
while ((zcur = AST_LIST_REMOVE_HEAD(&zones, list)))
|
||||
free_zone(zcur);
|
||||
AST_LIST_UNLOCK(&zones);
|
||||
}
|
||||
|
||||
static int load_config(int reload)
|
||||
{
|
||||
struct ast_vm_user *cur;
|
||||
struct vm_zone *zcur;
|
||||
struct ast_config *cfg, *ucfg;
|
||||
char *cat;
|
||||
struct ast_variable *var;
|
||||
|
@ -9591,17 +9612,14 @@ static int load_config(int reload)
|
|||
strcpy(listen_control_pause_key,DEFAULT_LISTEN_CONTROL_PAUSE_KEY);
|
||||
strcpy(listen_control_restart_key,DEFAULT_LISTEN_CONTROL_RESTART_KEY);
|
||||
strcpy(listen_control_stop_key,DEFAULT_LISTEN_CONTROL_STOP_KEY);
|
||||
|
||||
AST_LIST_LOCK(&users);
|
||||
while ((cur = AST_LIST_REMOVE_HEAD(&users, list))) {
|
||||
ast_set_flag(cur, VM_ALLOCED);
|
||||
free_user(cur);
|
||||
}
|
||||
|
||||
AST_LIST_LOCK(&zones);
|
||||
while ((zcur = AST_LIST_REMOVE_HEAD(&zones, list)))
|
||||
free_zone(zcur);
|
||||
AST_LIST_UNLOCK(&zones);
|
||||
/* Free all the users structure */
|
||||
free_vm_users();
|
||||
|
||||
/* Free all the zones structure */
|
||||
free_vm_zones();
|
||||
|
||||
AST_LIST_LOCK(&users);
|
||||
|
||||
memset(ext_pass_cmd, 0, sizeof(ext_pass_cmd));
|
||||
memset(ext_pass_check_cmd, 0, sizeof(ext_pass_check_cmd));
|
||||
|
@ -10263,6 +10281,9 @@ static int unload_module(void)
|
|||
mwi_subscription_tps = ast_taskprocessor_unreference(mwi_subscription_tps);
|
||||
ast_unload_realtime("voicemail");
|
||||
ast_unload_realtime("voicemail_data");
|
||||
|
||||
free_vm_users();
|
||||
free_vm_zones();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue