vp9_get_smooth_motion_field: check alloc
authorJames Zern <jzern@google.com>
Wed, 27 Apr 2022 05:19:05 +0000 (22:19 -0700)
committerJames Zern <jzern@google.com>
Wed, 27 Apr 2022 05:22:33 +0000 (22:22 -0700)
Change-Id: I6b19d0169d127f622abf97b3b8590eee957bdc51

vp9/encoder/vp9_non_greedy_mv.c

index 1c0d281..d52801c 100644 (file)
@@ -423,6 +423,7 @@ void vp9_get_smooth_motion_field(const MV *search_mf,
   int row, col;
   int bw = 4 << b_width_log2_lookup[bsize];
   int bh = 4 << b_height_log2_lookup[bsize];
+  if (!(input && output)) goto fail;
   // copy search results to input buffer
   for (idx = 0; idx < rows * cols; ++idx) {
     input[idx].row = (float)search_mf[idx].row / bh;
@@ -451,6 +452,7 @@ void vp9_get_smooth_motion_field(const MV *search_mf,
     smooth_mf[idx].row = (int)(input[idx].row * bh);
     smooth_mf[idx].col = (int)(input[idx].col * bw);
   }
+fail:
   free(input);
   free(output);
 }