[FFmpeg-devel] [PATCH 1/2] avformat/hls: check return value of new_init_section()

Marton Balint cus at passwd.hu
Sat Apr 10 13:08:35 EEST 2021


Fixes part of ticket #8931.

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavformat/hls.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 597bea7f25..b589ad2870 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -842,6 +842,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.26.2



More information about the ffmpeg-devel mailing list