diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c index 2f8e122a8ebff713b0277a8144ce8bab5e7ef542..731916f4d22624f0d006474e8a81a891be6f1443 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; }