shithub: libsamplerate

Download patch

ref: ce380434005fd546d4245cbf9896c3579e6b2081
parent: 3ccee2913529a7483062819543299eee681ec39a
author: Erik de Castro Lopo <erikd@mega-nerd.com>
date: Wed Nov 2 18:27:49 EDT 2011

Fix warnings from the Goanna static analysis tool.

--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,10 @@
     * examples/audio_out.[ch]
     On Linux used ALSA instead of OSS when available.
 
+    * src/samplerate.c src/src_linear.c src/src_zoh.c \
+            examples/sndfile-resample.c examples/timewarp-file.c
+    Fix warnings from the Goanna static analysis tool.
+
 2011-08-15  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * configure.ac
--- a/examples/sndfile-resample.c
+++ b/examples/sndfile-resample.c
@@ -237,7 +237,7 @@
 		src_data.input_frames -= src_data.input_frames_used ;
 		} ;
 
-	src_state = src_delete (src_state) ;
+	src_delete (src_state) ;
 
 	if (max > 1.0)
 	{	*gain = 1.0 / max ;
--- a/examples/timewarp-file.c
+++ b/examples/timewarp-file.c
@@ -176,7 +176,7 @@
 		src_data.input_frames -= src_data.input_frames_used ;
 		} ;
 
-	src_state = src_delete (src_state) ;
+	src_delete (src_state) ;
 
 	return output_count ;
 } /* timewarp_convert */
--- a/src/samplerate.c
+++ b/src/samplerate.c
@@ -453,7 +453,7 @@
 
 	error = src_process (src_state, src_data) ;
 
-	src_state = src_delete (src_state) ;
+	src_delete (src_state) ;
 
 	return error ;
 } /* src_simple */
--- a/src/src_linear.c
+++ b/src/src_linear.c
@@ -183,10 +183,11 @@
 
 	if (psrc->private_data == NULL)
 	{	priv = calloc (1, sizeof (*priv) + psrc->channels * sizeof (float)) ;
-		if (priv == NULL)
-			return SRC_ERR_MALLOC_FAILED ;
 		psrc->private_data = priv ;
 		} ;
+
+	if (priv == NULL)
+		return SRC_ERR_MALLOC_FAILED ;
 
 	priv->linear_magic_marker = LINEAR_MAGIC_MARKER ;
 	priv->channels = psrc->channels ;
--- a/src/src_zoh.c
+++ b/src/src_zoh.c
@@ -174,10 +174,11 @@
 
 	if (psrc->private_data == NULL)
 	{	priv = calloc (1, sizeof (*priv) + psrc->channels * sizeof (float)) ;
-		if (priv == NULL)
-			return SRC_ERR_MALLOC_FAILED ;
 		psrc->private_data = priv ;
 		} ;
+
+	if (priv == NULL)
+		return SRC_ERR_MALLOC_FAILED ;
 
 	priv->zoh_magic_marker = ZOH_MAGIC_MARKER ;
 	priv->channels = psrc->channels ;