[FFmpeg-devel] Memory leaks in libavformat/segment.c

Michael Niedermayer michaelni at gmx.at
Fri Dec 4 22:34:12 CET 2015


On Fri, Dec 04, 2015 at 11:20:17AM +0800, Lvqier wrote:
> Hi,
> 
> I am using FFmpeg to generate mpegts segments. FFmpeg has memory
> leaks, see the valgrind output in the attachment.
> 
> Command line to reproduce:
> > valgrind --tool=memcheck --leak-check=full ./ffmpeg_g -f decklink
> -i 'DeckLink Mini Recorder at 14' -map 0 -acodec libvo_aacenc -vcodec
> libx264 -pix_fmt yuv420p -vprofile baseline -q 2 -r 25 -g 25 -dn -f
> stream_segment -segment_format mpegts -segment_time 10
> /dev/shm/capture/libav-%010d.ts
> 
> I have read the source code of libavformat/segment.c and make a
> patch which is attached as well to fix it.
> 
> -- 
> /Best Regards,
> lvqier - lvqier at gmail.com <mailto:lvqier at gmail.com>
> /
> 
> ******************************************
> 青春如烟,唱一首笑忘歌
> 

>  segment.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> ecd80dc49306e15e9eff71f9192d7a861e53c4e5  patch.diff
> --- ../ffmpeg-2.8.1/libavformat/segment.c	2015-09-09 09:17:47.000000000 +0800

patches should be against git master


> +++ libavformat/segment.c	2015-12-03 14:37:45.000000000 +0800
> @@ -388,6 +388,7 @@
>  
>  end:
>      avio_closep(&oc->pb);
> +    av_freep(&seg->cur_entry.filename);
>  
>      return ret;
>  }
> @@ -887,7 +888,7 @@
>      av_opt_free(seg);
>      av_freep(&seg->times);
>      av_freep(&seg->frames);
> -    av_freep(&seg->cur_entry.filename);

> +//    av_freep(&seg->cur_entry.filename);

outcommented code like this doesnt belong in git master

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151204/f0259761/attachment.sig>


More information about the ffmpeg-devel mailing list