]> git.sesse.net Git - ffmpeg/commitdiff
avformat/hlsenc: Unconditionally free some strings
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 15 Dec 2019 17:48:28 +0000 (18:48 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 8 May 2020 13:30:56 +0000 (15:30 +0200)
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@gmail.com>
libavformat/hlsenc.c

index 0abda8ba30656a591a1e4c1cb47eeb6208824be2..20f66d52d1553b6a88bb3b08986a5163497a13ec 100644 (file)
@@ -2577,12 +2577,10 @@ static void hls_deinit(AVFormatContext *s)
         av_freep(&vs->basename);
         av_freep(&vs->base_output_dirname);
         av_freep(&vs->fmp4_init_filename);
-        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);
         avformat_free_context(vs->avf);
         if (hls->resend_init_file)
             av_freep(&vs->init_buffer);