mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Add 2 failed memory allocation checks
Originally committed as revision 24598 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
e35b689ebd
commit
e08ec71480
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user