Unified · Split
| @@ -70,6 +70,10 @@ static av_cold int libgsm_encode_init(AVCodecContext *avctx) { · 69 unmodified lines | ||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | avctx->coded_frame= avcodec_alloc_frame(); |
| 73 | + if (!avctx->coded_frame) { | |
| 74 | + gsm_destroy(avctx->priv_data); | |
| 75 | + return AVERROR(ENOMEM); | |
| 76 | + } | |
| 73 | 77 | |
| 74 | 78 | return 0; |
| 75 | 79 | } |
| @@ -196,10 +196,13 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx) · 195 unmodified lines | ||
| 196 | 196 | |
| 197 | 197 | avctx->frame_size = 160; |
| 198 | 198 | avctx->coded_frame = avcodec_alloc_frame(); |
| 199 | + if (!avctx->coded_frame) | |
| 200 | + return AVERROR(ENOMEM); | |
| 199 | 201 | |
| 200 | 202 | s->enc_state = Encoder_Interface_init(s->enc_dtx); |
| 201 | 203 | if (!s->enc_state) { |
| 202 | 204 | av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n"); |
| 205 | + av_freep(&avctx->coded_frame); | |
| 203 | 206 | return -1; |
| 204 | 207 | } |
| 205 | 208 | |
| @@ -39,6 +39,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) · 38 unmodified lines | ||
| 39 | 39 | int index; |
| 40 | 40 | |
| 41 | 41 | avctx->coded_frame = avcodec_alloc_frame(); |
| 42 | + if (!avctx->coded_frame) | |
| 43 | + return AVERROR(ENOMEM); | |
| 42 | 44 | avctx->frame_size = 1024; |
| 43 | 45 | |
| 44 | 46 | voGetAACEncAPI(&s->codec_api); |
| @@ -87,6 +87,8 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx) · 86 unmodified lines | ||
| 87 | 87 | |
| 88 | 88 | avctx->frame_size = 320; |
| 89 | 89 | avctx->coded_frame = avcodec_alloc_frame(); |
| 90 | + if (!avctx->coded_frame) | |
| 91 | + return AVERROR(ENOMEM); | |
| 90 | 92 | |
| 91 | 93 | s->state = E_IF_init(); |
| 92 | 94 | |
| @@ -181,6 +181,8 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) · 180 unmodified lines | ||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | avctx->coded_frame= avcodec_alloc_frame(); |
| 184 | + if (!avctx->coded_frame) | |
| 185 | + return AVERROR(ENOMEM); | |
| 184 | 186 | |
| 185 | 187 | return 0; |
| 186 | 188 | } |
| @@ -49,6 +49,8 @@ static av_cold int pcm_encode_init(AVCodecContext *avctx) · 48 unmodified lines | ||
| 49 | 49 | avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); |
| 50 | 50 | avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8; |
| 51 | 51 | avctx->coded_frame= avcodec_alloc_frame(); |
| 52 | + if (!avctx->coded_frame) | |
| 53 | + return AVERROR(ENOMEM); | |
| 52 | 54 | |
| 53 | 55 | return 0; |
| 54 | 56 | } |
| @@ -59,6 +59,8 @@ static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx) · 58 unmodified lines | ||
| 59 | 59 | context->lastSample[0] = context->lastSample[1] = 0; |
| 60 | 60 | |
| 61 | 61 | avctx->coded_frame= avcodec_alloc_frame(); |
| 62 | + if (!avctx->coded_frame) | |
| 63 | + return AVERROR(ENOMEM); | |
| 62 | 64 | |
| 63 | 65 | return 0; |
| 64 | 66 | } |