[FFmpeg-devel] [PATCH] libavformat/hls: check new_init_section for null

Steven Liu lingjiujianke at gmail.com
Wed Oct 14 06:10:31 EEST 2020


Chris Miceli <chris at miceli.net.au> 于2020年10月13日周二 下午1:59写道:
>
> new_init_section will return NULL under circumstances where the init
> failed and this code needed to check for that. ret and goto fail are how
> this is handled throughout the code.
> ---
>  libavformat/hls.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 72e28ab94f..6c5c2f2061 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -828,6 +828,10 @@ static int parse_playlist(HLSContext *c, const char *url,
>              ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_init_section_args,
>                                 &info);
>              cur_init_section = new_init_section(pls, &info, url);
> +            if (!cur_init_section) {
> +                ret = AVERROR(ENOMEM);
> +                goto fail;
> +            }
>              cur_init_section->key_type = key_type;
>              if (has_iv) {
>                  memcpy(cur_init_section->iv, iv, sizeof(iv));
> --
> 2.28.0
>
> _______________________________________________
> 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