Crash when deleting Celt.

BUG=issue 6087770
TEST=audio_coding_module_test

Review URL: https://webrtc-codereview.appspot.com/420001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1805 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tina.legrand@webrtc.org 2012-03-01 08:46:09 +00:00
parent c81012b8e5
commit 1f2cabaecd

View File

@ -182,17 +182,27 @@ AudioCodingModuleImpl::~AudioCodingModuleImpl()
{
if (_codecs[i] != NULL)
{
// True stereo codecs share the same memory for master and
// slave, so slave codec need to be nullified here, since the
// memory will be deleted.
if(_slaveCodecs[i] == _codecs[i]) {
_slaveCodecs[i] = NULL;
}
// Mirror index holds the address of the codec memory.
assert(_mirrorCodecIdx[i] > -1);
if(_codecs[_mirrorCodecIdx[i]] != NULL)
{
delete _codecs[_mirrorCodecIdx[i]];
_codecs[_mirrorCodecIdx[i]] = NULL;
}
_codecs[i] = NULL;
}
if(_slaveCodecs[i] != NULL)
{
// Delete memory for stereo usage of mono codecs.
assert(_mirrorCodecIdx[i] > -1);
if(_slaveCodecs[_mirrorCodecIdx[i]] != NULL)
{