Ensure that RELIABILITY is always fully constructed. 20130129030504/pspp 20130130030502/pspp 20130131030506/pspp 20130201030505/pspp 20130202030503/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 28 Jan 2013 18:00:29 +0000 (19:00 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 28 Jan 2013 18:00:29 +0000 (19:00 +0100)
Commit e94a39ff572a51907545497c26faccdf4b2c5ada added a 'no crash' test
checking that RELIABILITY's destructor didn't cause any problems when
the procedure was presented with invalid syntax.  Unfortunately the
associated fix was only half done.  The scale_name variable was being
destroyed when it hadn't been initialised.  This change fixes that.

Reported-by: Jeremy Lavergne
src/language/stats/reliability.c

index a9e33fb20a9095e9c56a69b66fabace4866846c3..695beabb5706d863dd716e5d24e1612afb9c777e 100644 (file)
@@ -143,6 +143,8 @@ cmd_reliability (struct lexer *lexer, struct dataset *ds)
   reliability.sc = NULL;
   reliability.wv = dict_get_weight (dict);
   reliability.total_start = 0;
+  ds_init_empty (&reliability.scale_name);
+
 
   lex_match (lexer, T_SLASH);
 
@@ -169,7 +171,7 @@ cmd_reliability (struct lexer *lexer, struct dataset *ds)
       reliability.n_sc = 1;
       reliability.sc = xzalloc (sizeof (struct cronbach) * reliability.n_sc);
 
-      ds_init_cstr (&reliability.scale_name, "ANY");
+      ds_assign_cstr (&reliability.scale_name, "ANY");
 
       c = &reliability.sc[0];
       c->n_items = reliability.n_variables;