]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mpegenc: Fix leak in case trailer is never written
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 15 Feb 2021 02:41:20 +0000 (03:41 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 19 Feb 2021 06:45:48 +0000 (07:45 +0100)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/mpegenc.c

index 810dd717ca5420ce51eee2a2c5f2f96f9a74630c..1204e57f0490a8379b4c3a2618684d907afed448 100644 (file)
@@ -1262,6 +1262,11 @@ static void mpeg_mux_deinit(AVFormatContext *ctx)
         StreamInfo *stream = ctx->streams[i]->priv_data;
         if (!stream)
             continue;
+        for (PacketDesc *pkt = stream->predecode_packet; pkt; ) {
+            PacketDesc *tmp = pkt->next;
+            av_free(pkt);
+            pkt = tmp;
+        }
         av_fifo_freep(&stream->fifo);
     }
 }