Handle malloc failure in mode_create gracefully without leaking memory.

This commit is contained in:
Gregory Maxwell 2009-06-04 17:17:35 -04:00 committed by Jean-Marc Valin
parent 1716999bbe
commit dc67fa9a4c
6 changed files with 122 additions and 21 deletions

View file

@ -104,6 +104,8 @@ int *quant_prob_alloc(const CELTMode *m)
int i;
int *prob;
prob = celt_alloc(4*m->nbEBands*sizeof(int));
if (prob==NULL)
return NULL;
for (i=0;i<m->nbEBands;i++)
{
prob[2*i] = 6000-i*200;