Check avcodec_alloc_frame() failure.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Peter Belkner 2011-04-19 11:58:53 +02:00 committed by Michael Niedermayer
parent c438c90756
commit 22fa406f38
1 changed files with 5 additions and 1 deletions

View File

@ -69,7 +69,11 @@ static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
avctx->frame_size = lame_get_framesize(s->gfp);
avctx->coded_frame= avcodec_alloc_frame();
if(!(avctx->coded_frame= avcodec_alloc_frame())) {
lame_close(s->gfp);
return AVERROR(ENOMEM);
}
avctx->coded_frame->key_frame= 1;
return 0;