diff mbox series

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

Message ID 20201013055929.239723-1-chris@miceli.net.au
State New
Headers show
Series [FFmpeg-devel] libavformat/hls: check new_init_section for null | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make warning Make failed

Commit Message

Chris Miceli Oct. 13, 2020, 5:59 a.m. UTC
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(+)

Comments

Steven Liu Oct. 14, 2020, 3:10 a.m. UTC | #1
Chris Miceli <chris@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@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

Thanks
Steven
diff mbox series

Patch

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));