From 16e52c86ba46e92d4a75e612d69ac97edb88a462 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 20 Sep 2012 05:38:53 +0200 Subject: [PATCH] error_resilience: guess_dc: check malloc failure Signed-off-by: Michael Niedermayer --- libavcodec/error_resilience.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 28cc08fd1b..6ae06f2ad1 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -183,6 +183,11 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int16_t (*col )[4] = av_malloc(stride*h*sizeof( int16_t)*4); uint32_t (*dist)[4] = av_malloc(stride*h*sizeof(uint32_t)*4); + if(!col || !dist) { + av_log(s->avctx, AV_LOG_ERROR, "guess_dc() is out of memory\n"); + goto fail; + } + for(b_y=0; b_y