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>
pull/355/head
Andreas Rheinhardt 4 years ago
parent 0336bbf68a
commit 432f291dff
  1. 1
      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);

Loading…
Cancel
Save