Replace malloc calls with xalloc