summaryrefslogtreecommitdiff
path: root/libavcodec/error_resilience.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-09-20 05:38:53 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-09-20 05:38:53 +0200
commit16e52c86ba46e92d4a75e612d69ac97edb88a462 (patch)
tree1bbd824825359bba1cabd8f8db2bd72fea19d24e /libavcodec/error_resilience.c
parentd2981b8ef191fc7876e3486e42222ab6a8777c24 (diff)
error_resilience: guess_dc: check malloc failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/error_resilience.c')
-rw-r--r--libavcodec/error_resilience.c7
1 files changed, 7 insertions, 0 deletions
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<h; b_y++){
int color= 1024;
int distance= -1;
@@ -263,6 +268,8 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w,
dc[b_x + b_y * stride] = guess;
}
}
+
+fail:
av_freep(&col);
av_freep(&dist);
}