]> granicus.if.org Git - libvpx/commitdiff
Fix scan_build warnings in vp9_resize.c
authorAngie Chiang <angiebird@google.com>
Tue, 20 Nov 2018 23:30:43 +0000 (15:30 -0800)
committerAngie Chiang <angiebird@google.com>
Wed, 21 Nov 2018 18:23:33 +0000 (10:23 -0800)
BUG=webm:1575

Change-Id: I5722d2626b9043b83581a700e58c2b7204113a16

vp9/encoder/vp9_resize.c

index 6ac77aeef28855c570cd228a0f9e37a2df8778c7..23a320ae55337a8510547e572d80563b3d705c32 100644 (file)
@@ -424,11 +424,11 @@ void vp9_resize_plane(const uint8_t *const input, int height, int width,
                       int in_stride, uint8_t *output, int height2, int width2,
                       int out_stride) {
   int i;
-  uint8_t *intbuf = (uint8_t *)malloc(sizeof(uint8_t) * width2 * height);
+  uint8_t *intbuf = (uint8_t *)calloc(width2 * height, sizeof(*intbuf));
   uint8_t *tmpbuf =
-      (uint8_t *)malloc(sizeof(uint8_t) * (width < height ? height : width));
-  uint8_t *arrbuf = (uint8_t *)malloc(sizeof(uint8_t) * height);
-  uint8_t *arrbuf2 = (uint8_t *)malloc(sizeof(uint8_t) * height2);
+      (uint8_t *)calloc(width < height ? height : width, sizeof(*tmpbuf));
+  uint8_t *arrbuf = (uint8_t *)calloc(height, sizeof(*arrbuf));
+  uint8_t *arrbuf2 = (uint8_t *)calloc(height2, sizeof(*arrbuf2));
   if (intbuf == NULL || tmpbuf == NULL || arrbuf == NULL || arrbuf2 == NULL)
     goto Error;
   assert(width > 0);