[asterisk-commits] qwell: branch 10 r354890 - in /branches/10: ./ apps/app_voicemail.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Feb 10 16:00:14 CST 2012
Author: qwell
Date: Fri Feb 10 16:00:10 2012
New Revision: 354890
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=354890
Log:
Fix a voicemail memory leak with heard/deleted messages.
open_mailbox() was changed quite a long time ago to allocate this memory.
close_mailbox() should have been changed to be responsible for freeing it.
........
Merged revisions 354889 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
branches/10/ (props changed)
branches/10/apps/app_voicemail.c
Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/10/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/apps/app_voicemail.c?view=diff&rev=354890&r1=354889&r2=354890
==============================================================================
--- branches/10/apps/app_voicemail.c (original)
+++ branches/10/apps/app_voicemail.c Fri Feb 10 16:00:10 2012
@@ -8017,11 +8017,11 @@
#endif
done:
- if (vms->deleted && vmu->maxmsg) {
- memset(vms->deleted, 0, vms->dh_arraysize * sizeof(int));
- }
- if (vms->heard && vmu->maxmsg) {
- memset(vms->heard, 0, vms->dh_arraysize * sizeof(int));
+ if (vms->deleted) {
+ ast_free(vms->deleted);
+ }
+ if (vms->heard) {
+ ast_free(vms->heard);
}
return 0;
@@ -10010,17 +10010,6 @@
vmstate_insert(&vms);
init_vm_state(&vms);
#endif
- /* Avoid allocating a buffer of 0 bytes, because some platforms really don't like that. */
- if (!(vms.deleted = ast_calloc(vmu->maxmsg ? vmu->maxmsg : 1, sizeof(int)))) {
- ast_log(AST_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 ? vmu->maxmsg : 1, sizeof(int)))) {
- ast_log(AST_LOG_ERROR, "Could not allocate memory for heard message storage!\n");
- cmd = ast_play_and_wait(chan, "an-error-has-occured");
- return -1;
- }
/* Set language from config to override channel language */
if (!ast_strlen_zero(vmu->language))
@@ -10603,10 +10592,6 @@
#endif
if (vmu)
free_user(vmu);
- if (vms.deleted)
- ast_free(vms.deleted);
- if (vms.heard)
- ast_free(vms.heard);
#ifdef IMAP_STORAGE
pthread_setspecific(ts_vmstate.key, NULL);
More information about the asterisk-commits
mailing list