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

Benoit Fouet benoit.fouet
Mon Jun 23 09:33:35 CEST 2008

Michael Niedermayer 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
> [...]


Benoit Fouet
Purple Labs S.A.

More information about the ffmpeg-devel mailing list