diff --git a/integrate.cpp b/integrate.cpp index f38a334c..d1eb4bbd 100644 --- a/integrate.cpp +++ b/integrate.cpp @@ -298,21 +298,15 @@ polint(LDBLE * xa, LDBLE * ya, int n, LDBLE xv, LDBLE * yv, LDBLE * dy) { int i, m, ns; LDBLE den, dif, dift, ho, hp, w; - LDBLE *c, *d; ns = 1; dif = fabs(xv - xa[1]); /* * Malloc work space */ - c = (LDBLE *) PHRQ_malloc(((size_t)n + 1) * sizeof(LDBLE)); - if (c == NULL) - malloc_error(); - d = (LDBLE *) PHRQ_malloc(((size_t)n + 1) * sizeof(LDBLE)); - if (d == NULL) - malloc_error(); - - + std::vector c, d; + c.resize((size_t)n + 1); + d.resize((size_t)n + 1); for (i = 1; i <= n; i++) { @@ -354,8 +348,6 @@ polint(LDBLE * xa, LDBLE * ya, int n, LDBLE xv, LDBLE * yv, LDBLE * dy) /* *yv += (*dy = (2 * ns < (n-m) ? c[ns+1] : d[ns--])); */ } - c = (LDBLE *) free_check_null(c); - d = (LDBLE *) free_check_null(d); return; }