vp9: check postproc_state.limits allocs
authorJames Zern <jzern@google.com>
Wed, 27 Apr 2022 02:05:56 +0000 (19:05 -0700)
committerJames Zern <jzern@google.com>
Wed, 27 Apr 2022 02:06:29 +0000 (19:06 -0700)
Change-Id: I9d5df96580074375e4847d2e2f60a6a6d56eeea5

vp9/common/vp9_postproc.c
vp9/encoder/vp9_encoder.c

index d2c8535..96519f0 100644 (file)
@@ -360,6 +360,7 @@ int vp9_post_proc_frame(struct VP9Common *cm, YV12_BUFFER_CONFIG *dest,
     if (!cm->postproc_state.limits) {
       cm->postproc_state.limits =
           vpx_calloc(unscaled_width, sizeof(*cm->postproc_state.limits));
+      if (!cm->postproc_state.limits) return 1;
     }
   }
 
index ec6a756..89b7c8e 100644 (file)
@@ -3684,9 +3684,9 @@ static void set_size_dependent_vars(VP9_COMP *cpi, int *q, int *bottom_index,
       case 6: l = 150; break;
     }
     if (!cpi->common.postproc_state.limits) {
-      cpi->common.postproc_state.limits =
-          vpx_calloc(cpi->un_scaled_source->y_width,
-                     sizeof(*cpi->common.postproc_state.limits));
+      CHECK_MEM_ERROR(cm, cpi->common.postproc_state.limits,
+                      vpx_calloc(cpi->un_scaled_source->y_width,
+                                 sizeof(*cpi->common.postproc_state.limits)));
     }
     vp9_denoise(&cpi->common, cpi->Source, cpi->Source, l,
                 cpi->common.postproc_state.limits);