diff mbox series

[FFmpeg-devel,v2,4/7] avformat/hlsenc: Unconditionally free some strings

Message ID 20200228095321.7222-4-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,v2,1/7] avformat/hlsenc: Avoid setting unused variables | expand


Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 28, 2020, 9:53 a.m. UTC
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 | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
diff mbox series


diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 18f40ff3ed..4628ea15c7 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2496,12 +2496,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);