From 7355c1dda2f8f21f699e720700c26dc8a666c6ec Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Thu, 11 May 2017 10:15:08 +0800 Subject: [PATCH] avformat/hlsenc: move old_filename free operation earlier Suggested-by: Aaron Levinson Reviewed-by: Aaron Levinson Signed-off-by: Steven Liu --- libavformat/hlsenc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 221089c1be..7ed121a5dd 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1549,14 +1549,13 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) sls_flag_file_rename(hls, old_filename); ret = hls_start(s); } + av_free(old_filename); if (ret < 0) { - av_free(old_filename); return ret; } if ((ret = hls_window(s, 0)) < 0) { - av_free(old_filename); return ret; } }