[FFmpeg-devel] [PATCH 1/3] avformat/hlsenc: Fix memleak when deleting old segments

Steven Liu lq at chinaffmpeg.org
Wed Apr 8 17:14:03 EEST 2020



> 2020年4月8日 下午9:35,Andreas Rheinhardt <andreas.rheinhardt at gmail.com> 写道:
> 
> if the directory name of the segments contains "%v".
> 
> This memleak is caused by masking the pointer that will eventually
> be freed by a variable of the same name in a smaller scope.
> Therefore the pointer that gets freed is always NULL when it is
> freed and the allocated data leaks.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
> libavformat/hlsenc.c | 1 -
> 1 file changed, 1 deletion(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index b4c72b6e54..0f1f558590 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -532,7 +532,6 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
>     /* if %v is present in the file's directory
>      * all segment belongs to the same variant, so do it only once before the loop*/
>     if (dirname && av_stristr(dirname, "%v")) {
> -        char * dirname_repl = dirname;
>         if (!vs->varname) {
>             if (replace_int_data_in_filename(&dirname_repl, dirname, 'v', segment->var_stream_idx) < 1) {
>                 ret = AVERROR(EINVAL);
> -- 
> 2.20.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

LGTM

Thanks

Steven Liu



More information about the ffmpeg-devel mailing list