[FFmpeg-trac] #7610(avformat:new): Memory leak in avformat/hls.c

FFmpeg trac at avcodec.org
Wed Dec 12 13:56:11 EET 2018

#7610: Memory leak in avformat/hls.c
             Reporter:  ValeryKot  |                     Type:  defect
               Status:  new        |                 Priority:  normal
            Component:  avformat   |                  Version:  git-master
             Keywords:             |               Blocked By:
             Blocking:             |  Reproduced by developer:  0
Analyzed by developer:  0          |
 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

Ticket URL: <https://trac.ffmpeg.org/ticket/7610>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list