Replace more malloc(X * Y) with reallocarray.