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

Michael Niedermayer michaelni
Fri Nov 13 18:55:09 CET 2009


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


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091113/176bfc38/attachment.pgp>



More information about the ffmpeg-devel mailing list