[FFmpeg-cvslog] r24598 - trunk/libavcodec/flacenc.c

jbr subversion
Fri Jul 30 20:34:39 CEST 2010


Author: jbr
Date: Fri Jul 30 20:34:39 2010
New Revision: 24598

Log:
Add 2 failed memory allocation checks

Modified:
   trunk/libavcodec/flacenc.c

Modified: trunk/libavcodec/flacenc.c
==============================================================================
--- trunk/libavcodec/flacenc.c	Fri Jul 30 20:30:09 2010	(r24597)
+++ trunk/libavcodec/flacenc.c	Fri Jul 30 20:34:39 2010	(r24598)
@@ -404,6 +404,8 @@ static av_cold int flac_encode_init(AVCo
     av_md5_init(s->md5ctx);
 
     streaminfo = av_malloc(FLAC_STREAMINFO_SIZE);
+    if (!streaminfo)
+        return AVERROR(ENOMEM);
     write_streaminfo(s, streaminfo);
     avctx->extradata = streaminfo;
     avctx->extradata_size = FLAC_STREAMINFO_SIZE;
@@ -412,6 +414,8 @@ static av_cold int flac_encode_init(AVCo
     s->min_framesize = s->max_framesize;
 
     avctx->coded_frame = avcodec_alloc_frame();
+    if (!avctx->coded_frame)
+        return AVERROR(ENOMEM);
     avctx->coded_frame->key_frame = 1;
 
     return 0;



More information about the ffmpeg-cvslog mailing list