From 52b5f34a17f85e61db57d23ab0b3c6489da862bb Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 5 Dec 2013 21:24:57 -0500 Subject: [PATCH] src/io/sink_sndfile.c: avoid a small memory leak when new_sink_sndfile fails --- src/io/sink_sndfile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/io/sink_sndfile.c b/src/io/sink_sndfile.c index 801b929a..7d2aaea9 100644 --- a/src/io/sink_sndfile.c +++ b/src/io/sink_sndfile.c @@ -70,6 +70,7 @@ aubio_sink_sndfile_t * new_aubio_sink_sndfile(char_t * path, uint_t samplerate) 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 @@ aubio_sink_sndfile_t * new_aubio_sink_sndfile(char_t * path, uint_t samplerate) 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); -- 2.11.0