[SCM] calf/master: Fix memory leak.

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:41:11 UTC 2013


The following commit has been merged in the master branch:
commit dab02e0f10a9475d904de3cc6e92f1dfb0d73df1
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Sat Sep 15 17:12:56 2012 +0100

    Fix memory leak.

diff --git a/src/calf/modules.h b/src/calf/modules.h
index 583ab9d..717cd63 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -327,6 +327,7 @@ public:
     bool get_graph(int index, int subindex, float *data, int points, cairo_iface *context, int *mode) const;
     bool get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const;
     bool get_clear_all(int index) const;
+    ~analyzer_audio_module();
     mutable int _mode_old;
     mutable bool _falling;
 protected:
diff --git a/src/modules.cpp b/src/modules.cpp
index 91c3c7f..12a3537 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -910,12 +910,37 @@ analyzer_audio_module::analyzer_audio_module() {
     memset(fft_freezeL, 0, max_fft_cache_size * sizeof(float));
     memset(fft_freezeR, 0, max_fft_cache_size * sizeof(float));
     
-    fft_plan = false;
+    fft_plan = NULL;
     
     ____analyzer_phase_was_drawn_here = 0;
     ____analyzer_sanitize = 0;
 }
 
+analyzer_audio_module::~analyzer_audio_module()
+{
+    free(fft_freezeR);
+    free(fft_freezeL);
+    free(fft_holdR);
+    free(fft_holdL);
+    free(fft_deltaR);
+    free(fft_deltaL);
+    free(fft_fallingR);
+    free(fft_fallingL);
+    free(fft_smoothR);
+    free(fft_smoothL);
+    free(fft_outR);
+    free(fft_outL);
+    free(fft_inR);
+    free(fft_inL);
+    free(phase_buffer);
+    free(spline_buffer);
+    if (fft_plan)
+    {
+        fftwf_destroy_plan(fft_plan);
+        fft_plan = NULL;
+    }
+}
+
 void analyzer_audio_module::activate() {
     active = true;
 }
@@ -1772,3 +1797,4 @@ bool analyzer_audio_module::get_clear_all(int index) const {
     }
     return false;
 }
+

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list