[FFmpeg-devel] [PATCH] fix h264 decoder memory leak

Benoit Fouet benoit.fouet
Fri Nov 13 19:33:54 CET 2009


On Fri, 13 Nov 2009 18:55:09 +0100 Michael Niedermayer wrote:
> On Fri, Nov 13, 2009 at 09:47:24AM -0500, Mike Scheutzow wrote:
> > Michael Niedermayer wrote:
> >> On Thu, Nov 12, 2009 at 09:52:07AM -0500, Mike Scheutzow wrote:
> >>> The attached patch fixes a memory leak in libavcodec/h264.c. Two buffers 
> >>> were still allocated after the h264 decoder is closed.
> >> there is code a few lines later that is supposed to free them
> >> also rbsp_buffer_size should be reset
> >
> > This memory leak occurs when free_tables() is called from 
> > av_parser_close(). In that situation, h->thread_context[0] is NULL.
> 
> maybe that is a bug ...
> 
> [...]
> > @@ -1999,6 +2003,8 @@
> >          av_freep(&hx->s.obmc_scratchpad);
> >          av_freep(&hx->rbsp_buffer[1]);
> >          av_freep(&hx->rbsp_buffer[0]);
> > +        hx->rbsp_buffer_size[0] = 0;
> > +        hx->rbsp_buffer_size[1] = 0;
> >          if (i) av_freep(&h->thread_context[i]);
> >      }
> >  }
> 
> this hunk is ok
> 
> 

hunk applied

Ben



More information about the ffmpeg-devel mailing list