Fixed malloc error reporting and warning on overlaping regions in memcpy