From 7107ed99c0ef492a09bc9e56615c9b16b750399a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 14 Dec 2018 14:59:14 +0100 Subject: [PATCH] [io] avoid crash when calling vorbis_close twice --- src/io/sink_vorbis.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- 2.11.0