From: John Darrington Date: Sun, 14 Oct 2018 19:06:56 +0000 (+0200) Subject: Fix possible null pointer dereference in linreg_predict. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2f53f8dd97ca2177a60f7c7e7d785d8e3e7faaa;p=pspp Fix possible null pointer dereference in linreg_predict. Found by cppcheck. --- diff --git a/src/math/linreg.c b/src/math/linreg.c index d1e0dae980..f88a18a5b8 100644 --- a/src/math/linreg.c +++ b/src/math/linreg.c @@ -275,11 +275,11 @@ linreg_predict (const struct linreg *c, const double *vals, size_t n_vals) size_t j; double result; - assert (n_vals == c->n_coeffs); if (vals == NULL || c == NULL) { return GSL_NAN; } + assert (n_vals == c->n_coeffs); if (c->coeff == NULL) { /* The stupid model: just guess the mean. */