avformat/webm_chunk: Close IO if writing header fails
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 29 Feb 2020 20:00:17 +0000 (21:00 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 26 Mar 2020 00:49:34 +0000 (01:49 +0100)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/webm_chunk.c

index d75fd5e..6daa6a0 100644 (file)
@@ -150,9 +150,9 @@ static int webm_chunk_write_header(AVFormatContext *s)
 
     oc->pb->seekable = 0;
     ret = oc->oformat->write_header(oc);
+    ff_format_io_close(s, &oc->pb);
     if (ret < 0)
         return ret;
-    ff_format_io_close(s, &oc->pb);
     for (i = 0; i < s->nb_streams; i++) {
         // ms precision is the de-facto standard timescale for mkv files.
         avpriv_set_pts_info(s->streams[i], 64, 1, 1000);