Opened 5 years ago

Closed 5 years ago

#7610 closed defect (fixed)

Memory leak in avformat/hls.c

Reported by: ValeryKot Owned by:
Priority: important Component: avformat
Version: git-master Keywords: hls leak regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When running ffmpeg continuously receiving an HLS stream for days, it slowly leaks memory. This behaviour is a degradation after release 4.0. To me it seems to be introduced by commit 673d8cfd51888963caafe46a6d9a8691d0e91caa "avformat/hls: fix seeking around EVENT playlist after media sequence"

It introduced new free_segment_dynarray(struct segment * * segments, int n_segments), which cleans all elements of segments, but not frees segments array itself. As a result, call at line 933 leaks:

free_segment_dynarray(prev_segments, prev_n_segments);

I guess that can be fixed by adding av_freep(prev_segments) immediately afterwards.

Change History (6)

comment:1 by ValeryKot, 5 years ago

av_freep(&prev_segments) is probably the correct fix, but I am a bit hesitant to supply a patch myself. Could an HLS maintainer take a look?

comment:2 by Carl Eugen Hoyos, 5 years ago

Keywords: hls leak regression added
Priority: normalimportant

Please either make this a valid ticket by providing valgrind output of a simplified command line or send your patch - made with git format-patch to the FFmpeg development mailing list.

comment:3 by ValeryKot, 5 years ago

I am working in Windows environment, so valgrind is not an option for me. I am now testing my patch locally and if it works I will send it to ffmpeg-devel.

Last edited 5 years ago by ValeryKot (previous) (diff)

in reply to:  2 ; comment:4 by ValeryKot, 5 years ago

Replying to cehoyos:

Please either make this a valid ticket by providing valgrind output of a simplified command line or send your patch - made with git format-patch to the FFmpeg development mailing list.

Patch submitted over a week ago (http://ffmpeg.org/pipermail/ffmpeg-devel/2018-December/237613.html). 0 reactions so far...

in reply to:  4 comment:5 by Carl Eugen Hoyos, 5 years ago

Replying to ValeryKot:

Replying to cehoyos:

Please either make this a valid ticket by providing valgrind output of a simplified command line or send your patch - made with git format-patch to the FFmpeg development mailing list.

Patch submitted over a week ago (http://ffmpeg.org/pipermail/ffmpeg-devel/2018-December/237613.html). 0 reactions so far...

Feel free to ping the patch or the hls maintainer.

comment:6 by Carl Eugen Hoyos, 5 years ago

Resolution: fixed
Status: newclosed

Your patch was applied as 3ee735901e08213a46a5f7339ca86c43524d6994

Note: See TracTickets for help on using tickets.