A malloc/free/realloc recode for understanding