From: Paul Brossier Date: Mon, 3 Feb 2014 19:21:11 +0000 (-0300) Subject: src/io/source_wavread.c: avoid calling fclose twice, print an error if fclose fails X-Git-Tag: 0.4.1~56 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=c1f0c1da94485f4669f6b4e7404a6dee10bcc568;p=aubio.git src/io/source_wavread.c: avoid calling fclose twice, print an error if fclose fails --- 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; }