memcpy for realloc