Added new function reallocarray. Intended to prevent overflows.