[Libav-user] Possible memory leak with respect to cleaning up RtpMuxContexts

Eric Reichert ereichert at trafficland.com
Thu Apr 23 20:04:42 CEST 2015

I’ve only been working with the FFMPEG libs (directly) for a few weeks so
 I’m not sure about what I’ve found.

I’ve created a short program that demonstrates the problem.  The program can be found at https://github.com/trafficland/rtpmemleak.

There’s a much more detailed explanation which can be found here https://github.com/trafficland/rtpmemleak/blob/master/README.md.

The short version is that after streaming packets to a multicast address using a RTP formatted stream, the RtpMuxContext.buf field is not released by avformat_close_input.

The only way to clean up that field is to do it manually as follows (a snippet from the code found at the links).

//*** The memory assigned to dstFmtCtxt->priv_data->buf must be cleaned up manually as it is not cleaned up by avformat_close_input
//*** Comment out the next 2 lines and run valgrind to see the leak stats.
RTPMuxContext* x = (struct RTPMuxContext *) dstFmtCtxt->priv_data;

Sample valgrind reports can be found at the links as well.

Is this a genuine leak or am I missing a cleanup call?

Eric Reichert

CONFIDENTIALITY NOTICE - The information contained in this e-mail and any accompanying documents may
 contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately alert the sender by reply e-mail and then delete this message, including any attachments. Any
 dissemination, distribution or other use of the contents of this message by
 anyone other than the intended recipient is strictly prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150423/0be3b44e/attachment.html>

More information about the Libav-user mailing list