shithub: libsamplerate

Download patch

ref: 57c95135b22feaa9984eb88caad05cf8de17f224
parent: cf3601b8909b861f1b24b786d91dd8a48570823a
author: Erik de Castro Lopo <erikd@mega-nerd.com>
date: Thu Aug 23 17:28:52 EDT 2012

tests/ : Use fftw_cleanup() to remove all memory leaks reported by valgrind.

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-08-23  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/multi_channel_test.c tests/snr_bw_test.c tests/varispeed_test.c
+    Use fftw_cleanup() to remove all memory leaks reported by valgrind.
+
 2012-08-22  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/src_sinc.c
--- a/tests/multi_channel_test.c
+++ b/tests/multi_channel_test.c
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -24,6 +24,15 @@
 #include <math.h>
 #include <assert.h>
 
+#if (HAVE_FFTW3)
+#include <fftw3.h>
+#else
+static inline void
+fftw_cleanup (void)
+{	return ;
+}
+#endif
+
 #include <samplerate.h>
 
 #include "util.h"
@@ -65,6 +74,7 @@
 		callback_test	(SRC_SINC_FASTEST, k, target) ;
 		} ;
 
+	fftw_cleanup () ;
 	puts ("") ;
 
 	return 0 ;
--- a/tests/snr_bw_test.c
+++ b/tests/snr_bw_test.c
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2002-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -26,6 +26,8 @@
 
 #if (HAVE_FFTW3)
 
+#include <fftw3.h>
+
 #include <samplerate.h>
 
 #include "util.h"
@@ -177,6 +179,8 @@
 
 		printf ("    Measured -3dB rolloff point      : %5.2f %%.\n\n", freq3dB) ;
 		} ;
+
+	fftw_cleanup () ;
 
 	return 0 ;
 } /* main */
--- a/tests/varispeed_test.c
+++ b/tests/varispeed_test.c
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) 2006-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
+** Copyright (C) 2006-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -42,6 +42,7 @@
 	printf ("    Sinc interpolator               : ") ;
 	varispeed_test (SRC_SINC_FASTEST, 115.0) ;
 
+	fftw_cleanup () ;
 	puts ("") ;
 
 	return 0 ;