examine.c: Fix a seg fault which caused a crash when recovering from bad syntax 20120331030503/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 31 Mar 2012 08:21:02 +0000 (10:21 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 31 Mar 2012 08:21:02 +0000 (10:21 +0200)
src/language/stats/examine.c
tests/language/stats/examine.at

index 88b3b542c8077594bdb059f8d334f100d6ef7600..6be74bc8fd6eee766c51bf02ac712e184329cabd 100644 (file)
@@ -2215,6 +2215,7 @@ cmd_examine (struct lexer *lexer, struct dataset *ds)
 
  error:
   caseproto_unref (examine.ex_proto);
+  examine.iacts = iacts_mem;
   for (i = 0; i < examine.n_iacts; ++i)
     interaction_destroy (examine.iacts[i]);
   free (examine.dep_vars);
index 045506357f3fddbac92871f96b42d00f1289985a..f152f72899c7cdec3f6176b7006e470931528547 100644 (file)
@@ -641,3 +641,32 @@ x,Highest,1,threehundred,300.00
 ])
 
 AT_CLEANUP 
+
+dnl Test for a crash which happened on cleanup from a bad input syntax
+AT_SETUP([EXAMINE -- Bad Input])
+
+AT_DATA([examine-bad.sps], [dnl
+data list list /h * g *.
+begin data.
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+end data.
+
+EXAMINE 
+       /VARIABLES= h
+       BY  g
+       /STATISTICS = DESCRIPTIVES EXTREME
+        /PLOT = lkajsdas
+       .
+])
+
+AT_CHECK([pspp -o pspp.csv examine-bad.sps], [1], [ignore])
+
+AT_CLEANUP