Message ID | 20200928173642.701462-1-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Commit | 432f291dffb0079bf447b1cdb8802a022298510f |
Headers | show |
Series | [FFmpeg-devel,1/3] avformat/movenc: Free old vos_data before overwriting it | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
Andreas Rheinhardt: > 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> > --- > libavformat/movenc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c > index a90bbfa458..c53be74a64 100644 > --- a/libavformat/movenc.c > +++ b/libavformat/movenc.c > @@ -6978,6 +6978,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); > Will apply this patchset tomorrow unless there are objections. - Andreas
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index a90bbfa458..c53be74a64 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6978,6 +6978,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);
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> --- libavformat/movenc.c | 1 + 1 file changed, 1 insertion(+)