]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgfortran/generated/spread_i1.c
Introduce xmallocarray, an overflow checking variant of xmalloc.
[thirdparty/gcc.git] / libgfortran / generated / spread_i1.c
index 083d26e41b95e9b3ce0a55a8a17d6006c6fc8e01..44aef16d3dfc4f128ad55a2a22efa5dc39cdbcd6 100644 (file)
@@ -101,8 +101,8 @@ spread_i1 (gfc_array_i1 *ret, const gfc_array_i1 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_1));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_1));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_i1 (gfc_array_i1 *ret, const GFC_INTEGER_1 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_1));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_1));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }