Fix stereo support; correctly deallocate bits_stereo.

This commit is contained in:
Gregory Maxwell 2008-10-03 17:12:44 -04:00 committed by Jean-Marc Valin
parent 60d0837ea0
commit b6a3b0c464
2 changed files with 30 additions and 7 deletions

View file

@ -394,7 +394,6 @@ CELTMode *celt_mode_create(celt_int32_t Fs, int channels, int frame_size, int *e
if (mode->nbChannels>=2)
mode->bits_stereo = (const celt_int16_t **)compute_alloc_cache(mode, mode->nbChannels);
mode->bits_stereo = NULL;
#ifndef SHORTCUTS
psydecay_init(&mode->psy, MAX_PERIOD/2, mode->Fs);
#endif
@ -430,6 +429,18 @@ void celt_mode_destroy(CELTMode *mode)
}
}
celt_free((int**)mode->bits);
if (mode->bits_stereo != NULL)
{
for (i=0;i<mode->nbEBands;i++)
{
if (mode->bits_stereo[i] != prevPtr)
{
prevPtr = mode->bits_stereo[i];
celt_free((int*)mode->bits_stereo[i]);
}
}
celt_free((int**)mode->bits_stereo);
}
if (check_mode(mode) != CELT_OK)
return;
celt_free((int*)mode->eBands);