Merge "app_voicemail: Don't delete mailbox state unless mailbox is deleted" into 16

This commit is contained in:
Friendly Automation 2018-12-19 05:05:54 -06:00 committed by Gerrit Code Review
commit 0110532bf9
1 changed files with 14 additions and 5 deletions

View File

@ -2043,10 +2043,6 @@ static void free_user(struct ast_vm_user *vmu)
return;
}
if (!ast_strlen_zero(vmu->mailbox)) {
ast_delete_mwi_state_full(vmu->mailbox, vmu->context, NULL);
}
ast_free(vmu->email);
vmu->email = NULL;
ast_free(vmu->emailbody);
@ -2059,6 +2055,19 @@ static void free_user(struct ast_vm_user *vmu)
}
}
static void free_user_final(struct ast_vm_user *vmu)
{
if (!vmu) {
return;
}
if (!ast_strlen_zero(vmu->mailbox)) {
ast_delete_mwi_state_full(vmu->mailbox, vmu->context, NULL);
}
free_user(vmu);
}
static int vm_allocate_dh(struct vm_state *vms, struct ast_vm_user *vmu, int count_msg) {
int arraysize = (vmu->maxmsg > count_msg ? vmu->maxmsg : count_msg);
@ -13540,7 +13549,7 @@ static void free_vm_users(void)
AST_LIST_LOCK(&users);
while ((current = AST_LIST_REMOVE_HEAD(&users, list))) {
ast_set_flag(current, VM_ALLOCED);
free_user(current);
free_user_final(current);
}
AST_LIST_UNLOCK(&users);
}