[FFmpeg-devel,v2,1/8] avformat/hlsenc: move freep segment from sls_flags_filename_process after caller failed

Submitted by Steven Liu on Oct. 10, 2019, 2:07 a.m.

Details

Message ID 20191010020756.30820-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu Oct. 10, 2019, 2:07 a.m.
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index cd4320114d..a1c03dbed5 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -887,7 +887,6 @@  static int sls_flags_filename_process(struct AVFormatContext *s, HLSContext *hls
         strlen(vs->current_segment_final_filename_fmt)) {
         char * new_url = av_strdup(vs->current_segment_final_filename_fmt);
         if (!new_url) {
-            av_freep(&en);
             return AVERROR(ENOMEM);
         }
         ff_format_set_url(vs->avf, new_url);
@@ -899,7 +898,6 @@  static int sls_flags_filename_process(struct AVFormatContext *s, HLSContext *hls
                        "you can try to remove second_level_segment_size flag\n",
                        vs->avf->url);
                 av_freep(&filename);
-                av_freep(&en);
                 return AVERROR(EINVAL);
             }
             ff_format_set_url(vs->avf, filename);
@@ -913,7 +911,6 @@  static int sls_flags_filename_process(struct AVFormatContext *s, HLSContext *hls
                        "you can try to remove second_level_segment_time flag\n",
                        vs->avf->url);
                 av_freep(&filename);
-                av_freep(&en);
                 return AVERROR(EINVAL);
             }
             ff_format_set_url(vs->avf, filename);
@@ -1035,6 +1032,7 @@  static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls,
     en->var_stream_idx = vs->var_stream_idx;
     ret = sls_flags_filename_process(s, hls, vs, en, duration, pos, size);
     if (ret < 0) {
+        av_freep(&en);
         return ret;
     }