[FFmpeg-devel] [PATCH 6/7] lavc/mjpegenc: check av_frame_alloc() failure.

Nicolas George george at nsup.org
Sun Dec 29 11:11:47 CET 2013


Signed-off-by: Nicolas George <george at nsup.org>
---
 libavcodec/mjpegenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index f23343a..7837ce9 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -548,6 +548,8 @@ static int amv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
         return -1;
 
     pic = av_frame_alloc();
+    if (!pic)
+        return AVERROR(ENOMEM);
     av_frame_ref(pic, pic_arg);
     //picture should be flipped upside-down
     for(i=0; i < 3; i++) {
-- 
1.8.5.2



More information about the ffmpeg-devel mailing list