From: Ben Pfaff Date: Thu, 20 Sep 2007 04:48:13 +0000 (+0000) Subject: Fix bug #21108. X-Git-Tag: v0.6.0~262 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=952c7c512b2eb481df13e25e65a73bf562ca6e81;p=pspp-builds.git Fix bug #21108. * aggregate.c (cmd_aggregate): Destroy casereader consistently, even if casereader fails. * examine.q (run_examine): Ditto. * glm.q (run_glm): Ditto. * oneway.q (run_oneway): Ditto. * regression.q (run_regression): Ditto. * t-test.q (calculate): Ditto. * descriptives.c (calc_descriptives): Ditto. Also avoid gratuitous casereader_clone. --- diff --git a/src/language/stats/ChangeLog b/src/language/stats/ChangeLog index a36249a9..4f63f167 100644 --- a/src/language/stats/ChangeLog +++ b/src/language/stats/ChangeLog @@ -1,3 +1,23 @@ +2007-09-19 Ben Pfaff + + Fix bug #21108. + + * aggregate.c (cmd_aggregate): Destroy casereader consistently, + even if casereader fails. + + * examine.q (run_examine): Ditto. + + * glm.q (run_glm): Ditto. + + * oneway.q (run_oneway): Ditto. + + * regression.q (run_regression): Ditto. + + * t-test.q (calculate): Ditto. + + * descriptives.c (calc_descriptives): Ditto. Also avoid + gratuitous casereader_clone. + 2007-09-13 Jason Stover * regression.q (cmd_regression): Move declaration of models in to diff --git a/src/language/stats/aggregate.c b/src/language/stats/aggregate.c index a9e1e4a4..921c8ed0 100644 --- a/src/language/stats/aggregate.c +++ b/src/language/stats/aggregate.c @@ -291,7 +291,10 @@ cmd_aggregate (struct lexer *lexer, struct dataset *ds) struct ccase c; if (!casereader_peek (group, 0, &c)) - continue; + { + casereader_destroy (group); + continue; + } initialize_aggregate_info (&agr, &c); case_destroy (&c); diff --git a/src/language/stats/descriptives.c b/src/language/stats/descriptives.c index 3fd23c8f..0b0d25bd 100644 --- a/src/language/stats/descriptives.c +++ b/src/language/stats/descriptives.c @@ -699,16 +699,18 @@ calc_descriptives (struct dsc_proc *dsc, struct casereader *group, size_t i; if (!casereader_peek (group, 0, &c)) - return; + { + casereader_destroy (group); + return; + } output_split_file_values (ds, &c); case_destroy (&c); group = casereader_create_filter_weight (group, dataset_dict (ds), NULL, NULL); - casereader_split (group, &pass1, &pass2); - if (dsc->max_moment <= MOMENT_MEAN) - casereader_destroy (pass2); + pass1 = group; + pass2 = dsc->max_moment <= MOMENT_MEAN ? NULL : casereader_clone (pass1); for (i = 0; i < dsc->var_cnt; i++) { @@ -758,7 +760,10 @@ calc_descriptives (struct dsc_proc *dsc, struct casereader *group, } } if (!casereader_destroy (pass1)) - return; + { + casereader_destroy (pass2); + return; + } /* Second pass for higher-order moments. */ if (dsc->max_moment > MOMENT_MEAN) diff --git a/src/language/stats/examine.q b/src/language/stats/examine.q index d9b9bece..4ad02303 100644 --- a/src/language/stats/examine.q +++ b/src/language/stats/examine.q @@ -720,7 +720,10 @@ run_examine (struct cmd_examine *cmd, struct casereader *input, struct factor *fctr; if (!casereader_peek (input, 0, &c)) - return; + { + casereader_destroy (input); + return; + } output_split_file_values (ds, &c); case_destroy (&c); diff --git a/src/language/stats/glm.q b/src/language/stats/glm.q index b1211265..e7620a30 100644 --- a/src/language/stats/glm.q +++ b/src/language/stats/glm.q @@ -251,7 +251,10 @@ run_glm (struct casereader *input, assert (model != NULL); if (!casereader_peek (input, 0, &c)) - return true; + { + casereader_destroy (input); + return true; + } output_split_file_values (ds, &c); case_destroy (&c); diff --git a/src/language/stats/oneway.q b/src/language/stats/oneway.q index 2ca7809b..f33a990e 100644 --- a/src/language/stats/oneway.q +++ b/src/language/stats/oneway.q @@ -899,7 +899,10 @@ run_oneway (struct cmd_oneway *cmd, struct ccase c; if (!casereader_peek (input, 0, &c)) - return; + { + casereader_destroy (input); + return; + } output_split_file_values (ds, &c); case_destroy (&c); diff --git a/src/language/stats/regression.q b/src/language/stats/regression.q index c10cc59e..0b7250ce 100644 --- a/src/language/stats/regression.q +++ b/src/language/stats/regression.q @@ -1136,7 +1136,10 @@ run_regression (struct casereader *input, struct cmd_regression *cmd, assert (models != NULL); if (!casereader_peek (input, 0, &c)) - return true; + { + casereader_destroy (input); + return true; + } output_split_file_values (ds, &c); case_destroy (&c); diff --git a/src/language/stats/t-test.q b/src/language/stats/t-test.q index a1665d53..db57c499 100644 --- a/src/language/stats/t-test.q +++ b/src/language/stats/t-test.q @@ -1787,7 +1787,10 @@ calculate(struct cmd_t_test *cmd, enum mv_class exclude = cmd->miss != TTS_INCLUDE ? MV_ANY : MV_SYSTEM; if (!casereader_peek (input, 0, &c)) - return; + { + casereader_destroy (input); + return; + } output_split_file_values (ds, &c); case_destroy (&c);