+2007-09-13 Jason Stover <jhs@debs.hoobahooba.net>
+
+ * regression.q (cmd_regression): Move declaration of models in to
+ definition of cmd_regression.
+
+ * regression.q (run_regression): Free mom to fix memory leak.
+
2007-09-12 Ben Pfaff <blp@gnu.org>
* crosstabs.q (postcalc): Free sorted_tab and the structures that
const struct variable *v;
};
-/* Linear regression models. */
-static pspp_linreg_cache **models = NULL;
-
/*
Transformations for saving predicted values
and residuals, etc.
static struct file_handle *model_file;
static bool run_regression (struct casereader *, struct cmd_regression *,
- struct dataset *);
+ struct dataset *, pspp_linreg_cache **);
/*
STATISTICS subcommand output functions.
{
struct casegrouper *grouper;
struct casereader *group;
+ pspp_linreg_cache **models;
bool ok;
size_t i;
/* Data pass. */
grouper = casegrouper_create_splits (proc_open (ds), dataset_dict (ds));
while (casegrouper_get_next_group (grouper, &group))
- run_regression (group, &cmd, ds);
+ run_regression (group, &cmd, ds, models);
ok = casegrouper_destroy (grouper);
ok = proc_commit (ds) && ok;
static bool
run_regression (struct casereader *input, struct cmd_regression *cmd,
- struct dataset *ds)
+ struct dataset *ds, pspp_linreg_cache **models)
{
size_t i;
int n_indep = 0;
}
casereader_destroy (reader);
}
+ for (i = 0; i < n_variables; i++)
+ {
+ moments1_destroy ((mom + i)->m);
+ }
+ free (mom);
free (indep_vars);
free (lopts.get_indep_mean_std);
casereader_destroy (input);