[FFmpeg-cvslog] r18406 - in trunk/libavcodec: h264.c h264.h h264_parser.c

Reimar Döffinger Reimar.Doeffinger
Fri Apr 10 13:37:04 CEST 2009


On Fri, Apr 10, 2009 at 12:32:10PM +0200, Reimar D?ffinger wrote:
> On Fri, Apr 10, 2009 at 09:01:56AM +0200, reimar wrote:
> > Author: reimar
> > Date: Fri Apr 10 09:01:55 2009
> > New Revision: 18406
> > 
> > Log:
> > Add a ff_h264_free_context function and call it from the H.264 parser.
> > This ensures that the parser will no longer leak memory for all SPS/PPS it encounters.
> 
> Hmm.. there is a problem I missed...
> ff_h264_free_context calls free_tables - I think that would not be
> necessary to fix the memleak, but it does seem safer.
> The problem is though, that free_tables contains this:
> > for(i = 0; i < h->s.avctx->thread_count; i++) {
> and avctx is not set in the parser.
> Does adding a
> if (!h->s.avctx) return;
> before that seem a reasonable solution?

Actually, this seems like a good solution to me:
Index: libavcodec/h264.c
===================================================================
--- libavcodec/h264.c   (revision 18412)
+++ libavcodec/h264.c   (working copy)
@@ -1989,7 +1989,7 @@
     av_freep(&h->mb2b_xy);
     av_freep(&h->mb2b8_xy);
 
-    for(i = 0; i < h->s.avctx->thread_count; i++) {
+    for(i = 0; i < MAX_THREADS; i++) {
         hx = h->thread_context[i];
         if(!hx) continue;
         av_freep(&hx->top_borders[1]);




More information about the ffmpeg-cvslog mailing list