[FFmpeg-cvslog] avformat/oggenc: free buffered page lists while uninitializing the muxer

James Almer git at videolan.org
Mon Oct 21 23:37:08 EEST 2019


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sun Oct 20 23:38:05 2019 -0300| [cecf29eb1c41b9582355450fd505d865297ae82e] | committer: James Almer

avformat/oggenc: free buffered page lists while uninitializing the muxer

If the trailer is never writen, there could be buffered pages that would leak.

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cecf29eb1c41b9582355450fd505d865297ae82e
---

 libavformat/oggenc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 06021c4f4b..d3ae07351d 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -740,6 +740,8 @@ static int ogg_write_trailer(AVFormatContext *s)
 
 static void ogg_free(AVFormatContext *s)
 {
+    OGGContext *ogg = s->priv_data;
+    OGGPageList *p = ogg->page_list;
     int i;
 
     for (i = 0; i < s->nb_streams; i++) {
@@ -756,6 +758,13 @@ static void ogg_free(AVFormatContext *s)
         av_freep(&oggstream->header[1]);
         av_freep(&st->priv_data);
     }
+
+    while (p) {
+        OGGPageList *next = p->next;
+        av_free(p);
+        p = next;
+    }
+    ogg->page_list = NULL;
 }
 
 #if CONFIG_OGG_MUXER



More information about the ffmpeg-cvslog mailing list