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

Art Clarke aclarke
Fri Jun 20 15:08:51 CEST 2008


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.

- Art
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_static_leaks.patch
Type: text/x-patch
Size: 3176 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080620/3dbd6e17/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FfmpegLeak.c
Type: text/x-csrc
Size: 817 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080620/3dbd6e17/attachment.c>



More information about the ffmpeg-devel mailing list