Handle malloc failure in mode_create gracefully without leaking memory.
This commit is contained in:
parent
1716999bbe
commit
dc67fa9a4c
6 changed files with 122 additions and 21 deletions
|
@ -53,7 +53,9 @@ void psydecay_init(struct PsyDecay *decay, int len, celt_int32_t Fs)
|
|||
{
|
||||
int i;
|
||||
celt_word16_t *decayR = (celt_word16_t*)celt_alloc(sizeof(celt_word16_t)*len);
|
||||
/*decay->decayL = celt_alloc(sizeof(celt_word16_t)*len);*/
|
||||
decay->decayR = decayR;
|
||||
if (decayR==NULL)
|
||||
return;
|
||||
for (i=0;i<len;i++)
|
||||
{
|
||||
float f;
|
||||
|
@ -70,7 +72,6 @@ void psydecay_init(struct PsyDecay *decay, int len, celt_int32_t Fs)
|
|||
/*decay->decayL[i] = Q15ONE*pow(0.0031623f, deriv);*/
|
||||
/*printf ("%f %f\n", decayL[i], decayR[i]);*/
|
||||
}
|
||||
decay->decayR = decayR;
|
||||
}
|
||||
|
||||
void psydecay_clear(struct PsyDecay *decay)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue