diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-20 22:10:34 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-20 22:10:40 +0100 |
commit | fff5f6554006ee273f0564134e9463554701d971 (patch) | |
tree | 12d19b992e8fd6e31297a93cbe051e62adc9a519 | |
parent | 7cb24ecd4c41d3e31dd5d5f56e0f5bfa081ac5a7 (diff) | |
parent | c095137d1b02ba6812ca9a035fa53e8a3ff7dfec (diff) | |
download | ffmpeg-fff5f6554006ee273f0564134e9463554701d971.tar.gz |
Merge remote-tracking branch 'jamrial/release/0.11' into release/0.11
* jamrial/release/0.11:
lavc/bink: Chech for malloc failure
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-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 4ad2e6fd76..359c7572fb 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -169,7 +169,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; @@ -180,8 +180,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; } /** @@ -1272,7 +1276,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; @@ -1307,7 +1311,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) { |