cubic_spline: use calloc instead of malloc