summaryrefslogtreecommitdiff
path: root/libavcodec/libopencore-amr.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-02-15 19:26:09 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-02-25 11:49:41 -0500
commita8bdf2405c6027f45a899eaaa6ba74e97c1c2701 (patch)
tree0538bf58d2aca6d32b0dc45f5b2806b330b9898a /libavcodec/libopencore-amr.c
parent255ad8881db0fa937e3632c4937f23d29d0e423d (diff)
check for coded_frame allocation failure in several audio encoders
Diffstat (limited to 'libavcodec/libopencore-amr.c')
-rw-r--r--libavcodec/libopencore-amr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
index ded92179d3..ebbc0d90d7 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;
}