From 24b4e6c373f8f942b2417d3cfed508c065b9d69e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 29 Aug 2013 23:23:22 +0200 Subject: [PATCH] snow: Check av_frame_alloc() failures Signed-off-by: Michael Niedermayer --- libavcodec/snow.c | 4 ++++ libavcodec/snowenc.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 4ea82b35e9..1125b25367 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -462,10 +462,14 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ for(j=0; jlast_picture[i] = av_frame_alloc(); + if (!s->last_picture[i]) + goto fail; } s->mconly_picture = av_frame_alloc(); s->current_picture = av_frame_alloc(); + if (!s->mconly_picture || !s->current_picture) + goto fail; return 0; fail: diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index befa4d1373..250057521d 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -129,6 +129,8 @@ static av_cold int encode_init(AVCodecContext *avctx) ff_set_cmp(&s->dsp, s->dsp.me_sub_cmp, s->avctx->me_sub_cmp); s->input_picture = av_frame_alloc(); + if (!s->input_picture) + return AVERROR(ENOMEM); if ((ret = ff_get_buffer(s->avctx, s->input_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret;