[FFmpeg-cvslog] avcodec/roqvideoenc: Check for av_malloc_array() failure

Michael Niedermayer git at videolan.org
Tue Jan 13 16:34:55 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jan 13 15:14:27 2015 +0100| [295b79b5d8c0cf0a9691f8d6b512aa1e289d528d] | committer: Michael Niedermayer

avcodec/roqvideoenc: Check for av_malloc_array() failure

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

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

 libavcodec/roqvideoenc.c |    6 ++++++
 1 file changed, 6 insertions(+)

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



More information about the ffmpeg-cvslog mailing list