avformat/oggdec: Fix metadata memleak on multiple headers
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 6 Mar 2018 17:14:12 +0000 (18:14 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 7 Mar 2018 19:37:33 +0000 (20:37 +0100)
Fixes: Chromium bug 800123
Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/oggdec.c

index 38f6065..27d16a3 100644 (file)
@@ -128,7 +128,10 @@ static int ogg_restore(AVFormatContext *s)
     ogg->state = ost->next;
 
         for (i = 0; i < ogg->nstreams; i++) {
-            av_freep(&ogg->streams[i].buf);
+            struct ogg_stream *stream = &ogg->streams[i];
+            av_freep(&stream->buf);
+            av_freep(&stream->new_metadata);
+
             if (i >= ost->nstreams || !ost->streams[i].private) {
                 free_stream(s, i);
             }