diff mbox

[FFmpeg-devel] avformat/hlsenc: move old_filename free operation earlier

Message ID 20170510103314.4275-1-lq@chinaffmpeg.org
State Accepted
Commit 7355c1dda2f8f21f699e720700c26dc8a666c6ec
Headers show

Commit Message

Liu Steven May 10, 2017, 10:33 a.m. UTC
Suggested-by: Aaron Levinson <alevinsn@aracnet.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

Aaron Levinson May 11, 2017, 12:52 a.m. UTC | #1
On 5/10/2017 3:33 AM, Steven Liu wrote:
> Suggested-by: Aaron Levinson <alevinsn@aracnet.com>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/hlsenc.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 221089c..7ed121a 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;
>          }
>      }
>

LGTM

Aaron Levinson
Steven Liu May 11, 2017, 2:17 a.m. UTC | #2
2017-05-11 8:52 GMT+08:00 Aaron Levinson <alevinsn@aracnet.com>:

> On 5/10/2017 3:33 AM, Steven Liu wrote:
>
>> Suggested-by: Aaron Levinson <alevinsn@aracnet.com>
>> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
>> ---
>>  libavformat/hlsenc.c |    3 +--
>>  1 files changed, 1 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index 221089c..7ed121a 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;
>>          }
>>      }
>>
>>
> LGTM
>
> Aaron Levinson
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Applied


Thanks!
diff mbox

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 221089c..7ed121a 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;
         }
     }