[FFmpeg-cvslog] avformat/movenc: Free old vos_data before overwriting it

Andreas Rheinhardt git at videolan.org
Mon Oct 5 02:48:41 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Mon Sep 28 18:05:44 2020 +0200| [432f291dffb0079bf447b1cdb8802a022298510f] | committer: Andreas Rheinhardt

avformat/movenc: Free old vos_data before overwriting it

Otherwise the old data leaks whenever extradata needs to be rewritten
(e.g. when encoding FLAC with our encoder that sends an updated
extradata packet at the end).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavformat/movenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 7256eb2a0f..6ed93d89ea 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6983,6 +6983,7 @@ static int mov_write_trailer(AVFormatContext *s)
             AVCodecParameters *par = track->par;
 
             track->vos_len  = par->extradata_size;
+            av_freep(&track->vos_data);
             track->vos_data = av_malloc(track->vos_len + AV_INPUT_BUFFER_PADDING_SIZE);
             if (!track->vos_data)
                 return AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list