diff options
author | John Glover <j@johnglover.net> | 2013-06-14 11:47:06 +0200 |
---|---|---|
committer | John Glover <j@johnglover.net> | 2013-06-14 11:47:06 +0200 |
commit | 364d1a9352cf1adcf08fbd4f0e793f24540d7402 (patch) | |
tree | b001aadeb38c96104c6fbd026519c7161486cc28 /src | |
parent | 2114ea951d728527ff5e833030d717c635b51821 (diff) | |
download | simpl-364d1a9352cf1adcf08fbd4f0e793f24540d7402.tar.gz simpl-364d1a9352cf1adcf08fbd4f0e793f24540d7402.tar.bz2 simpl-364d1a9352cf1adcf08fbd4f0e793f24540d7402.zip |
Add basic SndObjPeakDetection tests. Fix memory leaks.
Diffstat (limited to 'src')
-rw-r--r-- | src/sndobj/FFT.cpp | 16 | ||||
-rw-r--r-- | src/sndobj/IFGram.cpp | 9 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/sndobj/FFT.cpp b/src/sndobj/FFT.cpp index 666fe88..d527ea5 100644 --- a/src/sndobj/FFT.cpp +++ b/src/sndobj/FFT.cpp @@ -108,8 +108,20 @@ FFT::~FFT(){ fftw_destroy_plan(m_plan); fftw_free(m_fftIn); fftw_free(m_fftOut); - delete[] m_counter; - delete[] m_sigframe; + if(m_counter){ + delete[] m_counter; + m_counter = NULL; + } + for(int i = 0; i < m_frames; i++){ + if(m_sigframe[i]){ + delete[] m_sigframe[i]; + m_sigframe[i] = NULL; + } + } + if(m_sigframe){ + delete[] m_sigframe; + m_sigframe = NULL; + } } void diff --git a/src/sndobj/IFGram.cpp b/src/sndobj/IFGram.cpp index a5b374d..fb4cfa7 100644 --- a/src/sndobj/IFGram.cpp +++ b/src/sndobj/IFGram.cpp @@ -60,7 +60,14 @@ IFGram::IFGram(Table* window, SndObj* input, double scale, } IFGram::~IFGram(){ - delete[] m_diffwin; + if(m_diffwin){ + delete[] m_diffwin; + m_diffwin = NULL; + } + if(m_pdiff){ + delete[] m_pdiff; + m_pdiff = NULL; + } fftw_destroy_plan(m_diffplan); fftw_free(m_diffsig); |