From: Jason H Stover Date: Fri, 29 Jan 2010 19:01:58 +0000 (-0500) Subject: Free linreg struct if no valid data; X-Git-Tag: fc11-x64-build80^0 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74469ec6a0f6b5b33c4afaace173710adac46634;hp=34bf67fbfdce409a1cefdc101518c633636c1f43;p=pspp-builds.git Free linreg struct if no valid data; no not attempt to save residuals or predicted values in this case --- diff --git a/src/language/stats/regression.q b/src/language/stats/regression.q index 5b063950..abb3bd35 100644 --- a/src/language/stats/regression.q +++ b/src/language/stats/regression.q @@ -659,8 +659,6 @@ subcommand_save (struct dataset *ds, int save, linreg ** models) int n_trns = 0; int i; - assert (models != NULL); - if (save) { /* Count the number of transformations we will need. */ @@ -954,6 +952,8 @@ run_regression (struct casereader *input, struct cmd_regression *cmd, { msg (SE, gettext ("No valid data found. This command was skipped.")); + linreg_free (models[k]); + models[k] = NULL; } } diff --git a/src/math/linreg.c b/src/math/linreg.c index b6d1c16c..bb4de0c2 100644 --- a/src/math/linreg.c +++ b/src/math/linreg.c @@ -71,7 +71,7 @@ linreg_alloc (const struct variable *depvar, const struct variable **indep_vars, { linreg *c; - c = (linreg *) malloc (sizeof (linreg)); + c = xmalloc (sizeof (linreg)); c->depvar = depvar; c->indep_vars = indep_vars; c->indep_means = gsl_vector_alloc (p);