From 22fa406f384eb9d825b1d691332e1f928750d55b Mon Sep 17 00:00:00 2001 From: Peter Belkner Date: Tue, 19 Apr 2011 11:58:53 +0200 Subject: [PATCH] Check avcodec_alloc_frame() failure. Signed-off-by: Michael Niedermayer --- libavcodec/libmp3lame.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index db0bc8259c..086c7dc7f9 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -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;