[FFmpeg-devel] [PATCH] libopencore-amr: check return value of avcodec_alloc_frame()
Paul B Mahol
onemda at gmail.com
Sat Jan 28 21:01:09 CET 2012
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavcodec/libopencore-amr.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
index 0de7130..7a0555e 100644
--- a/libavcodec/libopencore-amr.c
+++ b/libavcodec/libopencore-amr.c
@@ -196,10 +196,13 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx)
avctx->frame_size = 160;
avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
s->enc_state = Encoder_Interface_init(s->enc_dtx);
if (!s->enc_state) {
av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n");
+ av_freep(&avctx->coded_frame);
return -1;
}
--
1.7.7
More information about the ffmpeg-devel
mailing list