[FFmpeg-devel] [PATCH] v210enc: check return value of avcodec_alloc_frame()

Paul B Mahol onemda at gmail.com
Sat Jan 28 21:27:17 CET 2012


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/v210enc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
index 1a78aa2..947797d 100644
--- a/libavcodec/v210enc.c
+++ b/libavcodec/v210enc.c
@@ -41,8 +41,9 @@ static av_cold int encode_init(AVCodecContext *avctx)
                avctx->bits_per_raw_sample);
 
     avctx->coded_frame = avcodec_alloc_frame();
+    if (!avctx->coded_frame)
+        return AVERROR(ENOMEM);
 
-    avctx->coded_frame->key_frame = 1;
     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
 
     return 0;
-- 
1.7.7



More information about the ffmpeg-devel mailing list