diff mbox

[FFmpeg-devel,V1,5/5] lavf/hlsenc: free the old_filname to avoid memory leak

Message ID 1566219667-22805-5-git-send-email-mypopydev@gmail.com
State Accepted
Commit f36925201c591015b1fbd366df71317f0290cef2
Headers show

Commit Message

Jun Zhao Aug. 19, 2019, 1:01 p.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

free the old_filname to avoid memory leak in error handle
path.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavformat/hlsenc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Comments

Liu Steven Aug. 20, 2019, 1:39 a.m. UTC | #1
> 在 2019年8月19日,下午9:01,Jun Zhao <mypopydev@gmail.com> 写道:
> 
> From: Jun Zhao <barryjzhao@tencent.com>
> 
> free the old_filname to avoid memory leak in error handle
> path.
> 
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
> libavformat/hlsenc.c |    1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index f6f9c81..9099c84 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -2428,6 +2428,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
>         // if we're building a VOD playlist, skip writing the manifest multiple times, and just wait until the end
>         if (hls->pl_type != PLAYLIST_TYPE_VOD) {
>             if ((ret = hls_window(s, 0, vs)) < 0) {
> +                av_free(old_filename);
>                 return ret;
>             }
>         }
> -- 
> 1.7.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

LGTM  applied


Thanks
Steven
diff mbox

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index f6f9c81..9099c84 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2428,6 +2428,7 @@  static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
         // if we're building a VOD playlist, skip writing the manifest multiple times, and just wait until the end
         if (hls->pl_type != PLAYLIST_TYPE_VOD) {
             if ((ret = hls_window(s, 0, vs)) < 0) {
+                av_free(old_filename);
                 return ret;
             }
         }