{
int x;
free (rel->sc[j].items);
- moments1_destroy (rel->sc[j].total);
- for (x = 0; x < rel->sc[j].n_items; ++x)
- free (rel->sc[j].m[x]);
+ moments1_destroy (rel->sc[j].total);
+ if (rel->sc[j].m)
+ for (x = 0; x < rel->sc[j].n_items; ++x)
+ free (rel->sc[j].m[x]);
free (rel->sc[j].m);
}
struct casereader *group;
struct casegrouper *grouper = casegrouper_create_splits (proc_open (ds), dict);
+ int si;
+
+ for (si = 0 ; si < reliability->n_sc; ++si)
+ {
+ struct cronbach *s = &reliability->sc[si];
+ int i;
+
+ s->m = xzalloc (sizeof *s->m * s->n_items);
+ s->total = moments1_create (MOMENT_VARIANCE);
+
+ for (i = 0 ; i < s->n_items ; ++i )
+ s->m[i] = moments1_create (MOMENT_VARIANCE);
+ }
+
while (casegrouper_get_next_group (grouper, &group))
{
{
struct cronbach *s = &rel->sc[si];
- s->m = xzalloc (sizeof (s->m) * s->n_items);
- s->total = moments1_create (MOMENT_VARIANCE);
+ moments1_clear (s->total);
for (i = 0 ; i < s->n_items ; ++i )
- s->m[i] = moments1_create (MOMENT_VARIANCE);
+ moments1_clear (s->m[i]);
}
input = casereader_create_filter_missing (input,
AT_CHECK([pspp -O format=csv bad-syntax.sps], [1], [ignore])
AT_CLEANUP
+
+dnl Checks for a crash when bad syntax followed scale specification.
+AT_SETUP([RELIABILITY bad syntax 2])
+AT_DATA([bad-syntax.sps], [dnl
+new file.
+data list notable list /f01 f02 f03 f04 f05 f06 f07 f08 f09 f10 *.
+begin data.
+end data.
+
+* This syntax is incorrect
+reliability variables=f01 to f10/asdfj.
+])
+AT_CHECK([pspp -O format=csv bad-syntax.sps], [1], [ignore])
+AT_CLEANUP
+
+
+dnl Checks for a crash when the active file was empty. Bug #38660.
+AT_SETUP([RELIABILITY crash with no data])
+AT_DATA([reliability.sps], [dnl
+new file.
+data list notable list /f01 f02 f03 f04 f05 f06 f07 f08 f09 f10 *.
+begin data.
+end data.
+
+reliability variables=f01 to f10.
+])
+AT_CHECK([pspp -O format=csv reliability.sps], [0], [])
+AT_CLEANUP
+