Commit fef2f472 authored by Vittorio Giovara's avatar Vittorio Giovara Committed by Luca Barbato

xvid: Check memory allocation

parent 9fb483fe
......@@ -276,6 +276,8 @@ static int xvid_strip_vol_header(AVCodecContext *avctx, AVPacket *pkt,
/* We need to store the header, so extract it */
if (!avctx->extradata) {
avctx->extradata = av_malloc(vo_len);
if (!avctx->extradata)
return AVERROR(ENOMEM);
memcpy(avctx->extradata, pkt->data, vo_len);
avctx->extradata_size = vo_len;
}
......@@ -594,11 +596,15 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)
if (avctx->intra_matrix) {
intra = avctx->intra_matrix;
x->intra_matrix = av_malloc(sizeof(unsigned char) * 64);
if (!x->intra_matrix)
return AVERROR(ENOMEM);
} else
intra = NULL;
if (avctx->inter_matrix) {
inter = avctx->inter_matrix;
x->inter_matrix = av_malloc(sizeof(unsigned char) * 64);
if (!x->inter_matrix)
return AVERROR(ENOMEM);
} else
inter = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment