From patchwork Thu Oct 10 02:07:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 15649 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6A4E0444869 for ; Thu, 10 Oct 2019 05:08:15 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5A21C6881A4; Thu, 10 Oct 2019 05:08:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpproxy21.qq.com (smtpbg704.qq.com [203.205.195.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E8B216800A6 for ; Thu, 10 Oct 2019 05:08:07 +0300 (EEST) X-QQ-mid: bizesmtp22t1570673279trkm5mw0 Received: from localhost (unknown [47.90.47.25]) by esmtp6.qq.com (ESMTP) with id ; Thu, 10 Oct 2019 10:07:58 +0800 (CST) X-QQ-SSF: 01100000002000K0ZRF1B00A0000000 X-QQ-FEAT: abYypKmxrfQvs/RTIbtKufOIX3Au5Z5aVa9fpLTUUkvPMaufWRCoTv62yNgFn /PgUjK91eZ4nc+LJyCHjGxADdNyMA4OxmUFHEuKcLuMkLG0NnsG8TY+jLeIkCICr3kR2R8Z AYsO0E1vmf/FFavOeIY96UHY3Rp6Mv82oDo2um1fWur1rdcamjLhBfGh4uVwfWTVOLrZBKS p+O9M+xL3fywLyrtq5cJB28zhl7wWb23ax37jvgy24tBqYfsvPhER+5wRbMkZAse/RwB40A C1TSscLu4VZNzLxCxuPEZStgKrfRGEaPgBjvNl+RhecM5sYA2wgZrtyNs= X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Thu, 10 Oct 2019 10:07:49 +0800 Message-Id: <20191010020756.30820-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.10.1.382.ga23ca1b.dirty X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign4 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH v2 1/8] avformat/hlsenc: move freep segment from sls_flags_filename_process after caller failed X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Steven Liu --- libavformat/hlsenc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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; }