From 3caec9acde088184ec125733b3bdfd7e1cd019a8 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 25 Jan 2005 13:04:46 +0000 Subject: [PATCH] Fixed bug #11675 --- src/ChangeLog | 6 ++++ src/aggregate.c | 10 ++---- tests/Makefile.am | 1 + tests/bugs/agg_crash.sh | 73 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 8 deletions(-) create mode 100755 tests/bugs/agg_crash.sh diff --git a/src/ChangeLog b/src/ChangeLog index a7e6320a..649add82 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +Tue Jan 25 21:01:43 WST 2005 John Darrington + + * aggregate.c: Initialised the complete agr_proc structure. + Closes bug #11675 + + Sun Jan 23 23:02:21 2005 Ben Pfaff * print.c: (print_trns_free) Close the dfm writer if there is one, diff --git a/src/aggregate.c b/src/aggregate.c index ffd29166..46e743c9 100644 --- a/src/aggregate.c +++ b/src/aggregate.c @@ -161,15 +161,8 @@ cmd_aggregate (void) /* Have we seen these subcommands? */ unsigned seen = 0; - agr.writer = NULL; - agr.sink = NULL; + memset(&agr, 0 , sizeof (agr)); agr.missing = ITEMWISE; - agr.sort = NULL; - agr.break_vars = NULL; - agr.agr_vars = NULL; - agr.dict = NULL; - agr.case_cnt = 0; - agr.prev_break = NULL; agr.dict = dict_create (); dict_set_label (agr.dict, dict_get_label (default_dict)); @@ -670,6 +663,7 @@ agr_destroy (struct agr_proc *agr) } if (agr->dict != NULL) dict_destroy (agr->dict); + case_destroy (&agr->agr_case); } diff --git a/tests/Makefile.am b/tests/Makefile.am index 66faad06..9d051978 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -41,6 +41,7 @@ TESTS = \ command/tabs.sh \ command/use.sh \ command/weight.sh \ + bugs/agg_crash.sh \ bugs/alpha-freq.sh \ bugs/big-input.sh \ bugs/big-input-2.sh \ diff --git a/tests/bugs/agg_crash.sh b/tests/bugs/agg_crash.sh new file mode 100755 index 00000000..30d63be1 --- /dev/null +++ b/tests/bugs/agg_crash.sh @@ -0,0 +1,73 @@ +#!/bin/sh + +# This program tests for a bug which crashed pspp when doing a aggregate +# procedure + +TEMPDIR=/tmp/pspp-tst-$$ +TESTFILE=$TEMPDIR/`basename $0`.sps + +here=`pwd`; + +# ensure that top_srcdir is absolute +cd $top_srcdir; top_srcdir=`pwd` + +export STAT_CONFIG_PATH=$top_srcdir/config + + +cleanup() +{ + rm -rf $TEMPDIR +} + + +fail() +{ + echo $activity + echo FAILED + cleanup; + exit 1; +} + + +no_result() +{ + echo $activity + echo NO RESULT; + cleanup; + exit 2; +} + +pass() +{ + cleanup; + exit 0; +} + +mkdir -p $TEMPDIR + +cd $TEMPDIR + +activity="create program" +cat > $TESTFILE < /dev/null +if [ $? -ne 1 ] ; then fail ; fi + + +pass; -- 2.30.2