From 295b79b5d8c0cf0a9691f8d6b512aa1e289d528d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <michaelni@gmx.at> Date: Tue, 13 Jan 2015 15:14:27 +0100 Subject: [PATCH] avcodec/roqvideoenc: Check for av_malloc_array() failure Signed-off-by: Michael Niedermayer <michaelni@gmx.at> --- libavcodec/roqvideoenc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c index 2f8e122a8eb..731916f4d22 100644 --- a/libavcodec/roqvideoenc.c +++ b/libavcodec/roqvideoenc.c @@ -1042,6 +1042,12 @@ static av_cold int roq_encode_init(AVCodecContext *avctx) enc->last_motion8 = av_malloc_array ((enc->width*enc->height/64), sizeof(motion_vect)); + if (!enc->tmpData || !enc->this_motion4 || !enc->last_motion4 || + !enc->this_motion8 || !enc->last_motion8) { + roq_encode_end(avctx); + return AVERROR(ENOMEM); + } + return 0; } -- GitLab