[FFmpeg-devel] 0001-Fix-packet_buffer-memory-leak-in-avformat_free_conte.patch

Andrey Myznikov andrey.myznikov at gmail.com
Fri Aug 15 16:46:37 CEST 2014


     Attached path fixes potential memory leak in output format context 
when av_interleaved_write_frame() is used.
This function can use AVFormatContext.packet_buffer for packet ordering, 
but this buffer is not feed later in avformat_free_context().
The Valgrind utiluty clearly shows this leak.

Note polease that when closing input context with 
avformat_close_input(AVFormatContext **ps) , the packet_buffer is 
correctly freed by flush_packet_queue(s) -> 
free_packet_buffer(&s->packet_buffer, &s->packet_buffer_end). But 
free_packet_buffer() is declared as static in utils.c and can not be 
called directly from application code.

So, I propose to add this call into avformat_free_context() to avoid 
memory leaks on output.

     Andrey Myznikov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-packet_buffer-memory-leak-in-avformat_free_conte.patch
Type: text/x-patch
Size: 693 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140815/4d7fd07e/attachment.bin>

More information about the ffmpeg-devel mailing list