safeMalloc for 2 times