fixed look up of the number of variables
[pspp-builds.git] / src / language / stats / regression.q
index 49ea24187983f4cd056c8ac01c08ada580a65676..58822812648a03767314e2b19ee35b3c1a4cfc42 100644 (file)
@@ -516,14 +516,15 @@ regression_trns_proc (void *m, struct ccase *c, int case_idx UNUSED)
   assert (model->depvar != NULL);
   assert (model->resid != NULL);
   
-  vals = xnmalloc (n_variables, sizeof (*vals));
   dict_get_vars (default_dict, &vars, &n_vars, 1u << DC_ORDINARY);
+  vals = xnmalloc (n_vars, sizeof (*vals));
+  assert (vals != NULL);
   output = case_data_rw (c, model->resid->fv);
   assert (output != NULL);
 
   for (i = 0; i < n_vars; i++)
     {
-      /* Do not use the residual variable as a predictor. */
+      /* Do not use the residual variable. */
       if (vars[i]->index != model->resid->index) 
        {
          /* Do not use the dependent variable as a predictor. */