[FFmpeg-devel] [PATCH] hevc: Fix memory leak related to a53_caption data

Will Kelleher wkelleher at gogoair.com
Fri Apr 8 21:35:09 CEST 2016


On 04/08, Michael Niedermayer wrote:
> On Fri, Apr 08, 2016 at 10:05:13AM -0500, Will Kelleher wrote:
> > Signed-off-by: Will Kelleher <wkelleher at gogoair.com>
> > ---
> >  libavcodec/hevc_parser.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
> > index 4625e61..5558afc 100644
> > --- a/libavcodec/hevc_parser.c
> > +++ b/libavcodec/hevc_parser.c
> > @@ -202,6 +202,9 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
> >  
> >      gb = &h->HEVClc->gb;
> >  
> > +    h->a53_caption_size = 0;
> > +    av_freep(&h->a53_caption);
> > +
> 
> shouldnt this be in hevc_parser_close() ?
> 
> (actually it probably belongs somewhere closer into hevc as the code
>  allocating should also free but the other allocs are also seperate
>  from the freeing ...)

Let me spend a little more time tracing the hevc decode process - I
probably don't understand this code as well as I should.  I have just been
mirroring the existing h264 implementation of this feature.

The a53_caption buffer is normally realloc'd when each sei_nal is
parsed, and then freed after it gets written to the output frame's
side data in hevc_frame_start.

> 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Opposition brings concord. Out of discord comes the fairest harmony.
> -- Heraclitus



> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fffmpeg.org%2fmailman%2flistinfo%2fffmpeg-devel&data=01%7c01%7cwkelleher%40gogoair.com%7c7aa319b8e9d24407b0f708d35fdc8f3a%7c2e6508518649457ea18abc0264c3b7d0%7c1&sdata=G%2fCXmmQ3nQspFp%2bYaAEtgR5sPoLSfb2IMhJML7wOZWc%3d



More information about the ffmpeg-devel mailing list