aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-28 18:05:44 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-27 07:20:58 +0100
commit3fc8dc35896420385e265de676ea01ed1950d8bd (patch)
treeb253468d2dabab799fc6729527bc497727d05890
parentdc4e3b9586a28b4ef41c7e9de3d029fd2f200d45 (diff)
downloadffmpeg-3fc8dc35896420385e265de676ea01ed1950d8bd.tar.gz
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@gmail.com> (cherry picked from commit 432f291dffb0079bf447b1cdb8802a022298510f)
-rw-r--r--libavformat/movenc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 31edb9399e..a1c1a44f04 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6880,6 +6880,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);