*/
#include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
#include "avcodec.h"
#include "dsputil.h"
#include "binkdata.h"
*
* @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;
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;
}
/**
if ((ret = bink_decode_plane(c, &gb, plane_idx, !!plane)) < 0)
return ret;
} else {
- if ((ret = binkb_decode_plane(c, &gb, plane_idx, !pkt->pts, !!plane)) < 0)
+ if ((ret = binkb_decode_plane(c, &gb, plane_idx,
+ !avctx->frame_number, !!plane)) < 0)
return ret;
}
if (get_bits_count(&gb) >= bits_count)
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) {