summaryrefslogtreecommitdiff
path: root/libavcodec/motionpixels.c
diff options
context:
space:
mode:
authorPiotr Bandurski <ami_stuff@o2.pl>2013-09-14 04:03:11 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-14 04:12:21 +0200
commit8728360b5664ef9db31137d8d3104cac33b9a911 (patch)
treee4e74b6c03ece36bfc48cd4532756e4e6c3733d8 /libavcodec/motionpixels.c
parent90ca8142673697980a740ea2f723aa7a6d13b267 (diff)
downloadffmpeg-8728360b5664ef9db31137d8d3104cac33b9a911.tar.gz
avcodec/mationpixels: check for malloc failures
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/motionpixels.c')
-rw-r--r--libavcodec/motionpixels.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index 00c11482c9..1a62d475c7 100644
--- a/libavcodec/motionpixels.c
+++ b/libavcodec/motionpixels.c
@@ -68,6 +68,8 @@ static av_cold int mp_decode_init(AVCodecContext *avctx)
mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1;
mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel));
mp->hpt = av_mallocz(h4 * w4 / 16 * sizeof(YuvPixel));
+ if (!mp->changes_map || !mp->vpt || !mp->hpt)
+ return AVERROR(ENOMEM);
avctx->pix_fmt = AV_PIX_FMT_RGB555;
avcodec_get_frame_defaults(&mp->frame);
return 0;