aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-11-12 20:49:09 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-11-12 20:49:09 +0000
commitb20e743f4a98ad3cbb673f8cf71b7c19190bee16 (patch)
tree62908f56d96412a725895c2a92410ac2b452225d
parent974ccb7b0efb2e06058b37eef72a9c771525fec8 (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@294903 f38db490-d61c-443f-a65b-d21fe96a405b
-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 6f6a93286..dca093d43 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1744,6 +1744,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;
}
@@ -5969,7 +5970,7 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box)
/* for local storage, checks directory for messages up to maxmsg limit */
last_msg = last_message_index(vmu, vms->curdir);
- if (last_msg < 0)
+ if (last_msg < -1)
return last_msg;
else if (vms->lastmsg != last_msg)
{