# HG changeset patch # User jbr # Date 1280514879 0 # Node ID a2dfd6f9a580c54cf4940c979bdf39edb00237b3 # Parent c13e3c23d093b75f4a82f43a5a518119c2623e5d Add 2 failed memory allocation checks diff -r c13e3c23d093 -r a2dfd6f9a580 flacenc.c --- a/flacenc.c Fri Jul 30 18:30:09 2010 +0000 +++ b/flacenc.c Fri Jul 30 18:34:39 2010 +0000 @@ -404,6 +404,8 @@ 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 @@ 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;