summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJeff Peeler <jpeeler@digium.com>2010-11-12 20:53:08 +0000
committerJeff Peeler <jpeeler@digium.com>2010-11-12 20:53:08 +0000
commit03ec54e0284b07243fe1e3c2c81948f55cd28bea (patch)
treed26a90bc77e97125ba614854c68a203f8b5bca14 /apps
parent5d1cd7863a9e6aaf6eec11c7c1749bba4b03e3ec (diff)
Merged revisions 294905 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r294905 | jpeeler | 2010-11-12 14:52:06 -0600 (Fri, 12 Nov 2010) | 30 lines Merged revisions 294904 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r294904 | jpeeler | 2010-11-12 14:51:15 -0600 (Fri, 12 Nov 2010) | 23 lines Merged revisions 294903 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r294903 | jpeeler | 2010-11-12 14:49:09 -0600 (Fri, 12 Nov 2010) | 16 lines Fix regression causing abort in voicemail after opening a mailbox with no mesgs. In order to be more safe, some error handling code was changed to respect more error conditions including the potential memory allocation failure for deleted and heard message tracking introduced in 293004. However, last_message_index returns -1 for zero messages (perhaps as expected) and was triggering the stricter error checking. Because last_message_index is only called directly in one place, just return 0 from open_mailbox (for file based storage) when no messages are detected unless a real error has occurred. (closes issue #18240) Reported by: leobrown Patches: bug18240.1-6-2.diff.txt uploaded by alecdavis (license 585) Tested by: pabelanger ........ ................ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@294907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-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);