[FFmpeg-devel] [PATCH 04/12] lavf/mux: run AVCodec::deinit if write_header fails

Rodger Combs rodger.combs at gmail.com
Wed Apr 20 09:10:56 CEST 2016


---
 libavformat/mux.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 7a4cdb9..6f3bd4e 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -483,8 +483,11 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options)
         ret = s->oformat->write_header(s);
         if (ret >= 0 && s->pb && s->pb->error < 0)
             ret = s->pb->error;
-        if (ret < 0)
+        if (ret < 0) {
+            if (s->oformat->deinit)
+                s->oformat->deinit(s);
             return ret;
+        }
         if (s->flush_packets && s->pb && s->pb->error >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS)
             avio_flush(s->pb);
         s->internal->header_written = 1;
-- 
2.7.3



More information about the ffmpeg-devel mailing list