shithub: libsamplerate

Download patch

ref: 94966fc068cd2d38b92eab5769656e2434deecd7
parent: beed7b1e3fe8db029f4c5c5d3549504b5c2530c5
author: Erik de Castro Lopo <erikd@mega-nerd.com>
date: Fri Dec 12 15:08:23 EST 2008

src/src_*.c : Fix a potential memory leak.

--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@
     Fix a couple of very minor warnings uncovered by Erik Hovland using a
     static analysis tool.
 
+    * src/src_*.c
+    Fix a potential memory leak. Thanks to Peter G. Vavaroutsos for point this
+    out.
+
 2008-12-11  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * reconfigure.mk autogen.sh
--- a/src/src_linear.c
+++ b/src/src_linear.c
@@ -174,11 +174,8 @@
 		return SRC_ERR_BAD_CONVERTER ;
 
 	if (psrc->private_data != NULL)
-	{	priv = (LINEAR_DATA*) psrc->private_data ;
-		if (priv->linear_magic_marker != LINEAR_MAGIC_MARKER)
-		{	free (psrc->private_data) ;
-			psrc->private_data = NULL ;
-			} ;
+	{	free (psrc->private_data) ;
+		psrc->private_data = NULL ;
 		} ;
 
 	if (psrc->private_data == NULL)
--- a/src/src_sinc.c
+++ b/src/src_sinc.c
@@ -154,11 +154,8 @@
 		return SRC_ERR_SHIFT_BITS ;
 
 	if (psrc->private_data != NULL)
-	{	filter = (SINC_FILTER*) psrc->private_data ;
-		if (filter->sinc_magic_marker != SINC_MAGIC_MARKER)
-		{	free (psrc->private_data) ;
-			psrc->private_data = NULL ;
-			} ;
+	{	free (psrc->private_data) ;
+		psrc->private_data = NULL ;
 		} ;
 
 	memset (&temp_filter, 0, sizeof (temp_filter)) ;
--- a/src/src_zoh.c
+++ b/src/src_zoh.c
@@ -165,11 +165,8 @@
 		return SRC_ERR_BAD_CONVERTER ;
 
 	if (psrc->private_data != NULL)
-	{	priv = (ZOH_DATA*) psrc->private_data ;
-		if (priv->zoh_magic_marker != ZOH_MAGIC_MARKER)
-		{	free (psrc->private_data) ;
-			psrc->private_data = NULL ;
-			} ;
+	{	free (psrc->private_data) ;
+		psrc->private_data = NULL ;
 		} ;
 
 	if (psrc->private_data == NULL)