[FFmpeg-cvslog] Check avcodec_alloc_frame() failure.

Peter Belkner git at videolan.org
Tue Apr 19 14:56:37 CEST 2011


ffmpeg | branch: master | Peter Belkner <pbelkner at snafu.de> | Tue Apr 19 11:58:53 2011 +0200| [22fa406f384eb9d825b1d691332e1f928750d55b] | committer: Michael Niedermayer

Check avcodec_alloc_frame() failure.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=22fa406f384eb9d825b1d691332e1f928750d55b
---

 libavcodec/libmp3lame.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
index db0bc82..086c7dc 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;



More information about the ffmpeg-cvslog mailing list