diff options
author | James Almer <jamrial@gmail.com> | 2013-02-05 22:34:29 -0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2013-02-06 12:35:33 +0000 |
commit | 8ab2173ed141aa2c3336be7f9880340dfb8dcf5e (patch) | |
tree | e7d548f699930d0cb1e9905840db3f258b2b454f /libavcodec/bink.c | |
parent | 6c3888487686a2e6cd505cb60d58106954e3569b (diff) | |
download | ffmpeg-8ab2173ed141aa2c3336be7f9880340dfb8dcf5e.tar.gz |
lavc/bink: Chech for malloc failure
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/bink.c')
-rw-r--r-- | libavcodec/bink.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/bink.c b/libavcodec/bink.c index c2c1ea1b0c..a48b8465d7 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -170,7 +170,7 @@ static void init_lengths(BinkContext *c, int width, int bw) * * @param c decoder context */ -static av_cold void init_bundles(BinkContext *c) +static av_cold int init_bundles(BinkContext *c) { int bw, bh, blocks; int i; @@ -181,8 +181,12 @@ static av_cold void init_bundles(BinkContext *c) for (i = 0; i < BINKB_NB_SRC; i++) { c->bundle[i].data = av_malloc(blocks * 64); + if (!c->bundle[i].data) + return AVERROR(ENOMEM); c->bundle[i].data_end = c->bundle[i].data + blocks * 64; } + + return 0; } /** @@ -1304,7 +1308,10 @@ static av_cold int decode_init(AVCodecContext *avctx) ff_dsputil_init(&c->dsp, avctx); ff_binkdsp_init(&c->bdsp); - init_bundles(c); + if ((ret = init_bundles(c)) < 0) { + free_bundles(c); + return ret; + } if (c->version == 'b') { if (!binkb_initialised) { |