On 4/21/2017 3:30 AM, Aaron Levinson wrote: > From 4f27e910aca6dae6642b4d73cf07fa0d6c4b1618 Mon Sep 17 00:00:00 2001 > From: Aaron Levinson <alevi...@aracnet.com> > Date: Thu, 20 Apr 2017 23:20:20 -0700 > Subject: [PATCH] Fixed memory leaks associated with AVStream objects if > FF_API_LAVF_AVCTX is defined > > Purpose: Fixed memory leaks associated with AVStream objects if > FF_API_LAVF_AVCTX is defined. If FF_API_LAVF_AVCTX is defined, > AVStream::codec is set to an AVCodecContext object, and this wasn't > being deallocated properly when the AVStream object was freed. While > FF_API_LAVF_AVCTX has to do with deprecated functionality, in > practice, it will always be defined for typical builds currently, > since it is defined in libavformat\version.h if > LIBAVFORMAT_VERSION_MAJOR is less than 58, and > LIBAVFORMAT_VERSION_MAJOR is currently set to 57. > > Comments: > > -- libavformat/utils.c: Now using avcodec_free_context() to properly > deallocate st->codec in free_stream() if FF_API_LAVF_AVCTX is > defined. > --- > libavformat/utils.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/libavformat/utils.c b/libavformat/utils.c > index ba82a76..fbd8b58 100644 > --- a/libavformat/utils.c > +++ b/libavformat/utils.c > @@ -4266,9 +4266,7 @@ static void free_stream(AVStream **pst) > av_freep(&st->index_entries); > #if FF_API_LAVF_AVCTX > FF_DISABLE_DEPRECATION_WARNINGS > - av_freep(&st->codec->extradata); > - av_freep(&st->codec->subtitle_header); > - av_freep(&st->codec); > + avcodec_free_context(&st->codec); > FF_ENABLE_DEPRECATION_WARNINGS > #endif > av_freep(&st->priv_data);
Simplified the commit subject and applied, thanks. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel