summaryrefslogtreecommitdiff
path: root/libavformat/hls.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-12 19:03:18 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-12 19:03:18 +0200
commit7a27aa15ec940f315f5446875db3757191f01a26 (patch)
treed9c3abc1b5c2283b84a188c347c8a58937abcdb3 /libavformat/hls.c
parent70e022cfc5e364f6d210697bf0eb267e8289bd4d (diff)
avformat/hls: Handle read_buffer allocation failure
Fixes CID1297576 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/hls.c')
-rw-r--r--libavformat/hls.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 451b78eb98..3f1d97eb6f 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1340,6 +1340,12 @@ static int hls_read_header(AVFormatContext *s)
pls->cur_seq_no = select_cur_seq_no(c, pls);
pls->read_buffer = av_malloc(INITIAL_BUFFER_SIZE);
+ if (!pls->read_buffer){
+ ret = AVERROR(ENOMEM);
+ avformat_free_context(pls->ctx);
+ pls->ctx = NULL;
+ goto fail;
+ }
ffio_init_context(&pls->pb, pls->read_buffer, INITIAL_BUFFER_SIZE, 0, pls,
read_data, NULL, NULL);
pls->pb.seekable = 0;