Bug 886660 - Fix the leak in FFTBlock::SetFFTSize(); r=roc

This commit is contained in:
Ehsan Akhgari 2013-06-25 20:37:56 -04:00
parent d34c9f81ce
commit 17e7067306

View File

@ -28,8 +28,7 @@ public:
}
~FFTBlock()
{
free(mFFT);
free(mIFFT);
Clear();
}
void PerformFFT(const float* aData)
@ -68,7 +67,7 @@ public:
mFFTSize = aSize;
mOutputBuffer.SetLength(aSize / 2 + 1);
PodZero(mOutputBuffer.Elements(), aSize / 2 + 1);
mFFT = mIFFT = nullptr;
Clear();
}
uint32_t FFTSize() const
@ -97,6 +96,12 @@ private:
mIFFT = kiss_fftr_alloc(mFFTSize, 1, nullptr, nullptr);
}
}
void Clear()
{
free(mFFT);
free(mIFFT);
mFFT = mIFFT = nullptr;
}
private:
kiss_fftr_cfg mFFT, mIFFT;