[FFmpeg-devel] Memory leaks in libavformat/segment.c
Qier LU
lvqier at gmail.com
Sat Dec 5 11:02:09 CET 2015
Hi Michael,
The attached is against git master.
On Sat, Dec 5, 2015 at 5:34 AM, Michael Niedermayer <michaelni at gmx.at>
wrote:
> 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
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
--
牛奶糖有着让人幸福的味道
尝一下的话就会在嘴里像花儿绽放一样
-------------- next part --------------
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 8432d0f..b5ee207 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -388,6 +388,7 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last)
end:
avio_closep(&oc->pb);
+ av_freep(&seg->cur_entry.filename);
return ret;
}
@@ -887,7 +888,6 @@ fail:
av_opt_free(seg);
av_freep(&seg->times);
av_freep(&seg->frames);
- av_freep(&seg->cur_entry.filename);
cur = seg->segment_list_entries;
while (cur) {
More information about the ffmpeg-devel
mailing list