From: Paul Brossier Date: Fri, 6 Dec 2013 02:24:57 +0000 (-0500) Subject: src/io/sink_sndfile.c: avoid a small memory leak when new_sink_sndfile fails X-Git-Tag: 0.4.0-beta1~55 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=52b5f34a17f85e61db57d23ab0b3c6489da862bb;p=aubio.git src/io/sink_sndfile.c: avoid a small memory leak when new_sink_sndfile fails --- 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);