[FFmpeg-cvslog] avcodec/mationpixels: check for malloc failures

Piotr Bandurski git at videolan.org
Sat Sep 14 04:16:22 CEST 2013


ffmpeg | branch: master | Piotr Bandurski <ami_stuff at o2.pl> | Sat Sep 14 04:03:11 2013 +0200| [8728360b5664ef9db31137d8d3104cac33b9a911] | committer: Michael Niedermayer

avcodec/mationpixels: check for malloc failures

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8728360b5664ef9db31137d8d3104cac33b9a911
---

 libavcodec/motionpixels.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index 00c1148..1a62d47 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;



More information about the ffmpeg-cvslog mailing list