shithub: aubio

Download patch

ref: 52b5f34a17f85e61db57d23ab0b3c6489da862bb
parent: 294aff65731e7f2d5148376d6dad31743ed24008
author: Paul Brossier <[email protected]>
date: Thu Dec 5 16:24:57 EST 2013

src/io/sink_sndfile.c: avoid a small memory leak when new_sink_sndfile fails

--- a/src/io/sink_sndfile.c
+++ b/src/io/sink_sndfile.c
@@ -70,6 +70,7 @@
   if (s->handle == NULL) {
     /* show libsndfile err msg */
     AUBIO_ERR("Failed opening %s. %s\n", s->path, sf_strerror (NULL));
+    AUBIO_FREE(s);
     return NULL;
   }	
 
@@ -78,6 +79,7 @@
   if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) {
     AUBIO_ERR("%d x %d exceeds maximum aubio_sink_sndfile buffer size %d\n",
         s->max_size, s->channels, MAX_CHANNELS * MAX_CHANNELS);
+    AUBIO_FREE(s);
     return NULL;
   }
   s->scratch_data = AUBIO_ARRAY(float,s->scratch_size);