summaryrefslogtreecommitdiff
path: root/libavcodec/libxvid.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-05-31 14:54:48 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-05-31 15:03:31 +0200
commitfef2f4722bcbfe1c3802898b0f5deb6356132c91 (patch)
tree833c6293aeb4613cda85c260f5a2fa4660d48b78 /libavcodec/libxvid.c
parent9fb483fede7207c1f3965e5ae1ac0ee82e4d7a4e (diff)
xvid: Check memory allocation
Diffstat (limited to 'libavcodec/libxvid.c')
-rw-r--r--libavcodec/libxvid.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index 46da773052..97ff95b843 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -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;