[FFmpeg-devel] [PATCH] avformat/hls: Fix memleak when url is empty

Steven Liu lingjiujianke at gmail.com
Mon Aug 17 03:45:56 EEST 2020


Andreas Rheinhardt <andreas.rheinhardt at gmail.com> 于2020年8月15日周六 上午4:35写道:
>
> Fixes Coverity ID 1465888.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
> Why does this code actually not check the return value of
> ff_make_absolute_url()?
>
>  libavformat/hls.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 84f0a5f323..4a3e0d6842 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -311,8 +311,10 @@ static struct playlist *new_playlist(HLSContext *c, const char *url,
>          return NULL;
>      reset_packet(&pls->pkt);
>      ff_make_absolute_url(pls->url, sizeof(pls->url), base, url);
> -    if (!pls->url[0])
> +    if (!pls->url[0]) {
> +        av_free(pls);
>          return NULL;
> +    }
>      pls->seek_timestamp = AV_NOPTS_VALUE;
>
>      pls->is_id3_timestamped = -1;
> --
> 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


More information about the ffmpeg-devel mailing list