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

Paul B Mahol onemda at gmail.com
Sat Jan 28 21:12:43 CET 2012


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

diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c
index ac8c94a..da83341 100644
--- a/libavcodec/roqaudioenc.c
+++ b/libavcodec/roqaudioenc.c
@@ -59,7 +59,8 @@ static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
     context->lastSample[0] = context->lastSample[1] = 0;
 
     avctx->coded_frame= avcodec_alloc_frame();
-    avctx->coded_frame->key_frame= 1;
+    if (!avctx->coded_frame)
+        return AVERROR(ENOMEM);
 
     return 0;
 }
-- 
1.7.7



More information about the ffmpeg-devel mailing list