aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2010-07-30 18:34:39 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2010-07-30 18:34:39 +0000
commite08ec714801a8f8e72eeee57c2df48b8fbaf2e12 (patch)
treedf3bd299401ebc52c0e9d782117f19adf28a6721
parente35b689ebd106973677925abd0c821c85a76a7b4 (diff)
downloadffmpeg-e08ec714801a8f8e72eeee57c2df48b8fbaf2e12.tar.gz
Add 2 failed memory allocation checks
Originally committed as revision 24598 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/flacenc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 9877a838c4..31332a6d51 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -404,6 +404,8 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
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(AVCodecContext *avctx)
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;