From: Paul Brossier Date: Fri, 14 Dec 2018 13:59:14 +0000 (+0100) Subject: [io] avoid crash when calling vorbis_close twice X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=7107ed99c0ef492a09bc9e56615c9b16b750399a;p=aubio.git [io] avoid crash when calling vorbis_close twice --- diff --git a/src/io/sink_vorbis.c b/src/io/sink_vorbis.c index 3205ad09..0b955575 100644 --- a/src/io/sink_vorbis.c +++ b/src/io/sink_vorbis.c @@ -271,11 +271,12 @@ uint_t aubio_sink_vorbis_close (aubio_sink_vorbis_t *s) aubio_sink_vorbis_write(s); - if (fclose(s->fid)) { + if (s->fid && fclose(s->fid)) { AUBIO_ERR("sink_vorbis: Error closing file %s (%s)\n", s->path, strerror(errno)); return AUBIO_FAIL; } + s->fid = NULL; return AUBIO_OK; }