aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/libxvid.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-01-03 23:42:34 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-01-03 23:51:18 +0100
commit5c95de150f3b18f2e76fed670d6ea579feab1206 (patch)
tree068a62ca98c560f2e6d5d24f578fa425464a36f4 /libavcodec/libxvid.c
parentbd12aa2bc597f08409bede6d4c710eddf4d7c142 (diff)
downloadffmpeg-5c95de150f3b18f2e76fed670d6ea579feab1206.tar.gz
avcodec/libxvid: check for av_malloc*() failures
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libxvid.c')
-rw-r--r--libavcodec/libxvid.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index 64572daac9..7669fee943 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -287,6 +287,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;
}
@@ -625,11 +627,19 @@ 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) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
} else
intra = NULL;
if (avctx->inter_matrix) {
inter = avctx->inter_matrix;
x->inter_matrix = av_malloc(sizeof(unsigned char) * 64);
+ if (!x->inter_matrix) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
} else
inter = NULL;