UtVideoContext *utv = (UtVideoContext *)avctx->priv_data;
UtVideoExtra *info;
uint32_t flags, in_format;
+ int ret;
switch (avctx->pix_fmt) {
case AV_PIX_FMT_YUV420P:
* We use this buffer to hold the data that Ut Video returns,
* since we cannot decode planes separately with it.
*/
- utv->buf_size = avpicture_get_size(avctx->pix_fmt,
- avctx->width, avctx->height);
+ ret = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
+ if (ret < 0)
+ return ret;
+ utv->buf_size = ret;
+
utv->buffer = (uint8_t *)av_malloc(utv->buf_size);
if (utv->buffer == NULL) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate output buffer.\n");
+ av_free(info);
return AVERROR(ENOMEM);
}