diff options
author | James Almer <jamrial@gmail.com> | 2013-02-05 22:34:29 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2013-04-07 18:10:05 -0300 |
commit | 0b8198346150192579a6b9c2b3c8a7822f4bf5cb (patch) | |
tree | d9b3d3c6d16369c9c9e247b14e35bfebf87167e3 | |
parent | 6f5e1d581132092fdb2678edfd14dcae0ce2f461 (diff) | |
download | ffmpeg-0b8198346150192579a6b9c2b3c8a7822f4bf5cb.tar.gz |
lavc/bink: Chech for malloc failuren0.10.7
Based on commit 8ab2173ed141aa2c3336be7f9880340dfb8dcf5e
-rw-r--r-- | libavcodec/bink.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 39c94a088c..16e3fd67a9 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -167,7 +167,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; @@ -178,8 +178,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; } /** @@ -1266,7 +1270,7 @@ static av_cold int decode_init(AVCodecContext *avctx) BinkContext * const c = avctx->priv_data; static VLC_TYPE table[16 * 128][2]; static int binkb_initialised = 0; - int i; + int i, ret; int flags; c->version = avctx->codec_tag >> 24; @@ -1301,7 +1305,10 @@ static av_cold int decode_init(AVCodecContext *avctx) 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) { |