[FFmpeg-devel] mpegts memory leak

Uve W. Rick Uve.Rick
Tue Sep 28 22:42:56 CEST 2010

While doing test, I ran across a memory leak in the mpegts.c.

What I found was that more than one packet could be generated for each read.  Since only the last packet is returned, the memory for the other generated packets would be lost.

It is possible if a packet has a length of 0 and the next packet has a very short length on the same stream.  A transport stream does not normally do this, but if the data is corrupt, it is possible.

Here's a patch to fix the memory leak.  It's not very elegant, but the only real solution would be to put in a packet list, which did not seem appropriate.

The patch keeps the functionality the same as before, where the previous packet is discarded.

Uve Rick
Senior Software Engineer
General Atomics Aeronautical Systems
14250 Kirkham Way
San Diego, CA 92064

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpegts_leak.patch
Type: application/octet-stream
Size: 1613 bytes
Desc: mpegts_leak.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100928/a89fad7d/attachment.obj>

More information about the ffmpeg-devel mailing list