Opened 8 months ago

Closed 8 months 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 Changed 8 months ago by ValeryKot

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 follow-up: Changed 8 months ago by cehoyos

  • Keywords hls leak regression added
  • Priority changed from normal to important

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 Changed 8 months ago by ValeryKot

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 8 months ago by ValeryKot (previous) (diff)

comment:4 in reply to: ↑ 2 ; follow-up: Changed 8 months ago by 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...

comment:5 in reply to: ↑ 4 Changed 8 months ago by cehoyos

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 Changed 8 months ago by cehoyos

  • Resolution set to fixed
  • Status changed from new to closed

Your patch was applied as 3ee735901e08213a46a5f7339ca86c43524d6994

Note: See TracTickets for help on using tickets.