Check return value of malloc