Fix crash in app_voicemail during close_mailbox
authorMatthew Jordan <mjordan@digium.com>
Sat, 25 Feb 2012 17:22:55 +0000 (17:22 +0000)
committerMatthew Jordan <mjordan@digium.com>
Sat, 25 Feb 2012 17:22:55 +0000 (17:22 +0000)
commit5e40f2cd98143c2e3997375db24beee54e1e70a9
treea65af304457996ce2f3cd7e8a916550ca23449eb
parent0553e61207dce280db4d7bb1c308e1451e9b1449
Fix crash in app_voicemail during close_mailbox

In r354890, a memory leak in app_voicemail was fixed by properly disposing of
the allocated heard/deleted pointers.  However, there are situations,
particularly when no messages are found in a folder, where these pointers are
not allocated and not NULL.  In that case, an invalid free would be attempted,
which could crash app_voicemail.  As there are a number of code paths where
this could occur, this patch uses the number of messages detected in the folder
before it attempts to free the pointers.  This resolves the crash detected in
the Asterisk Test Suite's check_voicemail_nominal test.
........

Merged revisions 356797 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 356798 from http://svn.asterisk.org/svn/asterisk/branches/10

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356799 65c4cc65-6c06-0410-ace0-fbb531ad65f3
apps/app_voicemail.c