[FFmpeg-devel] avformat/hls.c: Fix memory leak

Valery Kot valery.kot at gmail.com
Fri Dec 14 14:45:17 EET 2018


Patch for https://trac.ffmpeg.org/ticket/7610

hls.c:933  free_segment_dynarray(prev_segments, prev_n_segments);
cleans all elements of prev_segments, but does not frees prev_segments
array itself. As a result, process slowly leaks memory every time it
updates playlist.

Added call to av_freep(&prev_segments)
-------------- next part --------------
From 90f3f7abd3561ef12404686dfac99940e8c5167e Mon Sep 17 00:00:00 2001
From: vkot <valery.kot at 4cinsights.com>
Date: Fri, 14 Dec 2018 13:38:05 +0100
Subject: [PATCH] Fix memory leak in hls.c

---
 libavformat/hls.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 8ad08baaed..63e1abe789 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -931,6 +931,7 @@ static int parse_playlist(HLSContext *c, const char *url,
                    prev_start_seq_no, pls->start_seq_no);
         }
         free_segment_dynarray(prev_segments, prev_n_segments);
+        av_freep(&prev_segments);
     }
     if (pls)
         pls->last_load_time = av_gettime_relative();
-- 
2.15.1.windows.2



More information about the ffmpeg-devel mailing list