From 2a448e92429884da3d7c15ae030f24cf40baa7f4 Mon Sep 17 00:00:00 2001 From: Dave French Date: Tue, 16 Dec 2014 23:02:45 +0000 Subject: [PATCH] EQ cleaning up memory management --- plugins/Eq/EqEffect.cpp | 4 ++++ plugins/Eq/EqParameterWidget.cpp | 4 ++++ plugins/Eq/EqSpectrumView.h | 10 +++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/Eq/EqEffect.cpp b/plugins/Eq/EqEffect.cpp index 75b7c8bb1..f344ed519 100644 --- a/plugins/Eq/EqEffect.cpp +++ b/plugins/Eq/EqEffect.cpp @@ -68,6 +68,10 @@ EqEffect::EqEffect(Model *parent, const Plugin::Descriptor::SubPluginFeatures::K EqEffect::~EqEffect() { + if(m_upBuf) + { + delete m_upBuf; + } } diff --git a/plugins/Eq/EqParameterWidget.cpp b/plugins/Eq/EqParameterWidget.cpp index cafe5ac23..0cbcd1bfb 100644 --- a/plugins/Eq/EqParameterWidget.cpp +++ b/plugins/Eq/EqParameterWidget.cpp @@ -53,6 +53,10 @@ EqParameterWidget::EqParameterWidget( QWidget *parent ) : EqParameterWidget::~EqParameterWidget() { + if(m_bands) + { + delete m_bands; + } } diff --git a/plugins/Eq/EqSpectrumView.h b/plugins/Eq/EqSpectrumView.h index 34bf09444..d86899eea 100644 --- a/plugins/Eq/EqSpectrumView.h +++ b/plugins/Eq/EqSpectrumView.h @@ -49,10 +49,16 @@ public: EqAnalyser() { m_inProgress=false; + m_specBuf = (fftwf_complex *) fftwf_malloc( ( FFT_BUFFER_SIZE + 1 ) * sizeof( fftwf_complex ) ); + m_fftPlan = fftwf_plan_dft_r2c_1d( FFT_BUFFER_SIZE*2, m_buffer, m_specBuf, FFTW_MEASURE ); clear(); } - + virtual ~EqAnalyser() + { + fftwf_destroy_plan( m_fftPlan ); + fftwf_free( m_specBuf ); + } bool getInProgress() @@ -67,8 +73,6 @@ public: m_framesFilledUp = 0; m_energy = 0; memset( m_buffer, 0, sizeof( m_buffer ) ); - m_specBuf = (fftwf_complex *) fftwf_malloc( ( FFT_BUFFER_SIZE + 1 ) * sizeof( fftwf_complex ) ); - m_fftPlan = fftwf_plan_dft_r2c_1d( FFT_BUFFER_SIZE*2, m_buffer, m_specBuf, FFTW_MEASURE ); }