aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index cda1d74bb..b22d3618c 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -2623,6 +2623,7 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
ast_log(LOG_WARNING, "The code expects the old messages to be checked first, fix the code.\n");
}
if (vm_allocate_dh(vms, vmu, box == 0 ? vms->vmArrayIndex + vms->oldmessages : vms->lastmsg)) {
+ ast_mutex_unlock(&vms->lock);
return -1;
}
@@ -7710,7 +7711,7 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
last_msg = last_message_index(vmu, vms->curdir);
ast_unlock_path(vms->curdir);
- if (last_msg < 0) {
+ if (last_msg < -1) {
return last_msg;
} else if (vms->lastmsg != last_msg) {
ast_log(LOG_NOTICE, "Mailbox: %s, expected %d but found %d message(s) in box with max threshold of %d.\n", vms->curdir, last_msg + 1, vms->lastmsg + 1, vmu->maxmsg);