[FFmpeg-devel] [PATCH 1/2] avformat/dashenc: Fix a resource leak when http persistent in enabled

Karthick J kjeyapal at akamai.com
Tue Jan 2 08:48:17 EET 2018


From: Karthick Jeyapal <kjeyapal at akamai.com>

---
 libavformat/dashenc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3345b89..c4c112b 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1,6 +1,7 @@
 /*
  * MPEG-DASH ISO BMFF segmenter
  * Copyright (c) 2014 Martin Storsjo
+ * Copyright (c) 2018 Akamai Technologies, Inc.
  *
  * This file is part of FFmpeg.
  *
@@ -1317,6 +1318,16 @@ static int dash_write_trailer(AVFormatContext *s)
     }
     dash_flush(s, 1, -1);
 
+    if (c->http_persistent) {
+        int i;
+        for (i = 0; i < s->nb_streams; i++) {
+            OutputStream *os = &c->streams[i];
+            ff_format_io_close(s, &os->out);
+        }
+        ff_format_io_close(s, &c->mpd_out);
+        ff_format_io_close(s, &c->m3u8_out);
+    }
+
     if (c->remove_at_exit) {
         char filename[1024];
         int i;
-- 
1.9.1



More information about the ffmpeg-devel mailing list