Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 90000) +++ apps/app_voicemail.c (working copy) @@ -5238,7 +5238,7 @@ ast_unlock_path(vms->curdir); #else if (vms->deleted) { - for (x=0;x < vmu->maxmsg;x++) { + for (x=0;x < MAXMSG;x++) { if (vms->deleted[x]) { ast_debug(3,"IMAP delete of %d\n",x); IMAP_DELETE(vms->curdir, x, vms->fn, vms); @@ -5248,10 +5248,17 @@ #endif done: +#ifndef IMAP_STORAGE if (vms->deleted) memset(vms->deleted, 0, vmu->maxmsg * sizeof(int)); if (vms->heard) memset(vms->heard, 0, vmu->maxmsg * sizeof(int)); +#else + if (vms->deleted) + memset(vms->deleted, 0, MAXMSG * sizeof(int)); + if (vms->heard) + memset(vms->heard, 0, MAXMSG * sizeof(int)); +#endif return 0; } @@ -6946,12 +6953,29 @@ if (!valid) goto out; +#ifdef IMAP_STORAGE + if (!(vms.deleted = ast_calloc(MAXMSG, sizeof(int)))) { + ast_log(LOG_ERROR, "Could not allocate memory for deleted message storage!\n"); + cmd = ast_play_and_wait(chan, "an-error-has-occured"); + return -1; + } + if (!(vms.heard = ast_calloc(MAXMSG, sizeof(int)))) { + ast_log(LOG_ERROR, "Could not allocate memory for heard message storage!\n"); + cmd = ast_play_and_wait(chan, "an-error-has-occured"); + return -1; + } +#else if (!(vms.deleted = ast_calloc(vmu->maxmsg, sizeof(int)))) { - /* TODO: Handle memory allocation failure */ + ast_log(LOG_ERROR, "Could not allocate memory for deleted message storage!\n"); + cmd = ast_play_and_wait(chan, "an-error-has-occured"); + return -1; } if (!(vms.heard = ast_calloc(vmu->maxmsg, sizeof(int)))) { - /* TODO: Handle memory allocation failure */ + ast_log(LOG_ERROR, "Could not allocate memory for heard message storage!\n"); + cmd = ast_play_and_wait(chan, "an-error-has-occured"); + return -1; } +#endif /* Set language from config to override channel language */ if (!ast_strlen_zero(vmu->language))