[FFmpeg-devel] Fix for static heap leaks in h263.c

Art Clarke aclarke
Fri Jun 20 19:53:58 CEST 2008


On Fri, Jun 20, 2008 at 1:38 PM, Michael Niedermayer <michaelni at gmx.at>
wrote:

> On Fri, Jun 20, 2008 at 09:08:51AM -0400, Art Clarke wrote:
> > per early discussion, folks allocating static tables should allocate them
> on
> > the stack, not the heap.
> >
> > patch attached.
> >
> > For what it's worth, I think the table-sizes I passed in are correct (I
> > derived them from looking at the exact heap-allocated size in a
> debugger),
> > but it seems fragile to just have the #s in the INIT_VLC_STATIC call.  If
> > there is a way to derive the VLC table size statically from the other
> > inputs, please let me know and I'll update the patch.
> >
> > To reproduce compile the attached FfmpegLeak.c program, and give it an
> FLV
> > file as input.  Then run through valgrind as follows:
> >
> > valgrind --leak-check=full --show-reachable=yes your_program
> your_input.flv
> >
> > you should see 11k leaked before the fix, and 0k leaked after the fix.
> >
> > As per Michael's suggestion, I'll hold off on other similar fixes (e.g.
> > mpegaudiodec.c:376) until folks have had a chance to review this for
> general
> > correctness.
>
> patch looks ok assuming it works and doesnt print any error messages
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

thx.  It does run through our test-suite with all passes (except for other
leaks), and all resulting video looks correct.  No new error messages are
generated.

I'll generate patches for other similar leaks on Monday and send them to the
list, unless someone else gets there first.

- Art




More information about the ffmpeg-devel mailing list