changeset 35:d6bb46a1e70c slimline

Fix big memory leak
author Chris Cannam
date Fri, 11 May 2012 17:37:49 +0100
parents f2db60706075
children cc18e9a13fe8
files songparts/SongParts.cpp
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/songparts/SongParts.cpp	Fri May 11 17:37:42 2012 +0100
+++ b/songparts/SongParts.cpp	Fri May 11 17:37:49 2012 +0100
@@ -163,12 +163,12 @@
         tuneLocal(0.0),
         doNormalizeChroma(0),
         rollon(0.0),
-            s(0.7),
-            sinvalues(0),
-            cosvalues(0),
-            window(HanningWindow, block_size),
-            fft(block_size),
-            inputSampleRate(inputSampleRate)
+        s(0.7),
+        sinvalues(0),
+        cosvalues(0),
+        window(HanningWindow, block_size),
+        fft(block_size),
+        inputSampleRate(inputSampleRate)
     {
         // make the *note* dictionary matrix
         dict = new float[nNote * 84];
@@ -368,6 +368,7 @@
 SongPartitioner::SongPartitioner(float inputSampleRate) :
     Vamp::Plugin(inputSampleRate),
     m_d(0),
+    m_chromadata(0),
     m_bpb(4),
     m_pluginFrameCount(0)
 {
@@ -378,6 +379,7 @@
 SongPartitioner::~SongPartitioner()
 {
     delete m_d;
+    delete m_chromadata;
 }
 
 
@@ -469,6 +471,10 @@
         delete m_d;
         m_d = 0;
     }
+    if (m_chromadata) {
+        delete m_chromadata;
+        m_chromadata = 0;
+    }
 
     if (channels < getMinChannelCount() ||
         channels > getMaxChannelCount()) {