changeset 12169:7501f327cfd1 libavcodec

vp8: Check for malloc failure
author conrad
date Fri, 16 Jul 2010 07:20:31 +0000
parents b246b214c2e9
children 6f0db2eeaf70
files vp8.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/vp8.c	Thu Jul 15 23:02:34 2010 +0000
+++ b/vp8.c	Fri Jul 16 07:20:31 2010 +0000
@@ -225,6 +225,9 @@
     s->intra4x4_pred_mode_base = av_mallocz(s->b4_stride*(4*s->mb_height+1));
     s->top_nnz                 = av_mallocz(s->mb_width*sizeof(*s->top_nnz));
 
+    if (!s->macroblocks_base || !s->intra4x4_pred_mode_base || !s->top_nnz)
+        return AVERROR(ENOMEM);
+
     s->macroblocks        = s->macroblocks_base        + 1 + s->mb_stride;
     s->intra4x4_pred_mode = s->intra4x4_pred_mode_base + 4 + s->b4_stride;