Bug 981931 - Stop leaking the allocated buffers in PeriodicWave::createBandLimitedTables; r=padenot
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 11 Mar 2014 00:41:19 -0400
changeset 191140 f86398fa5fac6dd2c59d4e2410b2c656ba1fa670
parent 191139 feebf1769138d91bbb9fab1a6f160052ad4fe737
child 191141 549d598666c218b13c1452388823ff39126f891d
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs981931
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 981931 - Stop leaking the allocated buffers in PeriodicWave::createBandLimitedTables; r=padenot
content/media/webaudio/blink/PeriodicWave.cpp
--- a/content/media/webaudio/blink/PeriodicWave.cpp
+++ b/content/media/webaudio/blink/PeriodicWave.cpp
@@ -159,18 +159,18 @@ void PeriodicWave::createBandLimitedTabl
 
     numberOfComponents = std::min(numberOfComponents, halfSize);
 
     m_bandLimitedTables.SetCapacity(m_numberOfRanges);
 
     for (unsigned rangeIndex = 0; rangeIndex < m_numberOfRanges; ++rangeIndex) {
         // This FFTBlock is used to cull partials (represented by frequency bins).
         FFTBlock frame(fftSize);
-        float* realP = new float[halfSize];
-        float* imagP = new float[halfSize];
+        nsAutoArrayPtr<float> realP(new float[halfSize]);
+        nsAutoArrayPtr<float> imagP(new float[halfSize]);
 
         // Copy from loaded frequency data and scale.
         float scale = fftSize;
         AudioBufferCopyWithScale(realData, scale, realP, numberOfComponents);
         AudioBufferCopyWithScale(imagData, scale, imagP, numberOfComponents);
 
         // If fewer components were provided than 1/2 FFT size,
         // then clear the remaining bins.