diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-02-15 19:26:09 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-02-25 11:49:41 -0500 |
commit | a8bdf2405c6027f45a899eaaa6ba74e97c1c2701 (patch) | |
tree | 0538bf58d2aca6d32b0dc45f5b2806b330b9898a | |
parent | 255ad8881db0fa937e3632c4937f23d29d0e423d (diff) | |
download | ffmpeg-a8bdf2405c6027f45a899eaaa6ba74e97c1c2701.tar.gz |
check for coded_frame allocation failure in several audio encoders
-rw-r--r-- | libavcodec/libgsm.c | 4 | ||||
-rw-r--r-- | libavcodec/libopencore-amr.c | 3 | ||||
-rw-r--r-- | libavcodec/libvo-aacenc.c | 2 | ||||
-rw-r--r-- | libavcodec/libvo-amrwbenc.c | 2 | ||||
-rw-r--r-- | libavcodec/mpegaudioenc.c | 2 | ||||
-rw-r--r-- | libavcodec/pcm.c | 2 | ||||
-rw-r--r-- | libavcodec/roqaudioenc.c | 2 |
7 files changed, 17 insertions, 0 deletions
diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c index b917cc374d..fb7b196022 100644 --- a/libavcodec/libgsm.c +++ b/libavcodec/libgsm.c @@ -70,6 +70,10 @@ static av_cold int libgsm_encode_init(AVCodecContext *avctx) { } avctx->coded_frame= avcodec_alloc_frame(); + if (!avctx->coded_frame) { + gsm_destroy(avctx->priv_data); + return AVERROR(ENOMEM); + } return 0; } 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; } diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c index 280ba27ef9..0a4a270eda 100644 --- a/libavcodec/libvo-aacenc.c +++ b/libavcodec/libvo-aacenc.c @@ -39,6 +39,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) int index; avctx->coded_frame = avcodec_alloc_frame(); + if (!avctx->coded_frame) + return AVERROR(ENOMEM); avctx->frame_size = 1024; voGetAACEncAPI(&s->codec_api); diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index 5214ee6d2e..7e8721015b 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -87,6 +87,8 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx) avctx->frame_size = 320; avctx->coded_frame = avcodec_alloc_frame(); + if (!avctx->coded_frame) + return AVERROR(ENOMEM); s->state = E_IF_init(); diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index d2b1e70900..455c4b2662 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -181,6 +181,8 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) } avctx->coded_frame= avcodec_alloc_frame(); + if (!avctx->coded_frame) + return AVERROR(ENOMEM); return 0; } diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 2e0b5ec4b0..d0407453de 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -49,6 +49,8 @@ static av_cold int pcm_encode_init(AVCodecContext *avctx) avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8; avctx->coded_frame= avcodec_alloc_frame(); + if (!avctx->coded_frame) + return AVERROR(ENOMEM); return 0; } diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c index e2d0f3896e..3747f18c1b 100644 --- a/libavcodec/roqaudioenc.c +++ b/libavcodec/roqaudioenc.c @@ -59,6 +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(); + if (!avctx->coded_frame) + return AVERROR(ENOMEM); return 0; } |