From c1f0c1da94485f4669f6b4e7404a6dee10bcc568 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 3 Feb 2014 16:21:11 -0300 Subject: [PATCH] src/io/source_wavread.c: avoid calling fclose twice, print an error if fclose fails --- src/io/source_wavread.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/io/source_wavread.c b/src/io/source_wavread.c index d5878687..2058b44f 100644 --- a/src/io/source_wavread.c +++ b/src/io/source_wavread.c @@ -347,9 +347,14 @@ uint_t aubio_source_wavread_seek (aubio_source_wavread_t * s, uint_t pos) { } uint_t aubio_source_wavread_close (aubio_source_wavread_t * s) { - if (!s->fid || fclose(s->fid)) { + if (!s->fid) { + return AUBIO_FAIL; + } + if (fclose(s->fid)) { + AUBIO_ERR("source_wavread: could not close %s (%s)\n", s->path, strerror(errno)); return AUBIO_FAIL; } + s->fid = NULL; return AUBIO_OK; } -- 2.11.0