From: John Darrington Date: Mon, 28 Jan 2013 18:00:29 +0000 (+0100) Subject: Ensure that RELIABILITY is always fully constructed. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fbuilds%2F20130131030506%2Fpspp;p=pspp Ensure that RELIABILITY is always fully constructed. 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 --- diff --git a/src/language/stats/reliability.c b/src/language/stats/reliability.c index a9e33fb20a..695beabb57 100644 --- a/src/language/stats/reliability.c +++ b/src/language/stats/reliability.c @@ -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;