[FFmpeg-cvslog] avformat/hlsenc: Unconditionally free some strings

Andreas Rheinhardt git at videolan.org
Fri May 8 16:34:55 EEST 2020

ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sun Dec 15 18:48:28 2019 +0100| [191b51254cf5d37c84af51d434993efe174b0977] | committer: Andreas Rheinhardt

avformat/hlsenc: Unconditionally free some strings

hls_init() would at first allocate the vtt_basename string, then
allocate the vtt_m3u8_name string followed by several operations that
may fail and then open the subtitles' output context. Yet upon freeing,
these strings were only freed when the subtitles' output context
existed, ensuring that they leak if something goes wrong between their
allocation and the opening of the subtitles' output context. So drop the
check for whether this output context exists.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=191b51254cf5d37c84af51d434993efe174b0977

 libavformat/hlsenc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 0abda8ba30..20f66d52d1 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2577,12 +2577,10 @@ static void hls_deinit(AVFormatContext *s)
-        if (vtt_oc) {
-            av_freep(&vs->vtt_basename);
-            av_freep(&vs->vtt_m3u8_name);
-            avformat_free_context(vtt_oc);
-        }
+        av_freep(&vs->vtt_basename);
+        av_freep(&vs->vtt_m3u8_name);
+        avformat_free_context(vtt_oc);
         if (hls->resend_init_file)

More information about the ffmpeg-cvslog mailing list