From: Ben Pfaff Date: Mon, 26 Nov 2018 01:47:45 +0000 (-0800) Subject: ONEWAY: Fix use of stack-allocated variable outside its scope. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9d098309d97db3b0b66c194f0d2bbdebf2c70c0;p=pspp ONEWAY: Fix use of stack-allocated variable outside its scope. The 'payload' object is a kind of class and should be allocated statically. Found by Address Sanitizer. --- diff --git a/src/language/stats/oneway.c b/src/language/stats/oneway.c index cbc00e0fdd..da24cb6625 100644 --- a/src/language/stats/oneway.c +++ b/src/language/stats/oneway.c @@ -711,11 +711,13 @@ run_oneway (const struct oneway_spec *cmd, for (v = 0; v < cmd->n_vars; ++v) { - struct payload payload; - payload.create = makeit; - payload.update = updateit; - payload.calculate = NULL; - payload.destroy = killit; + static const struct payload payload = + { + .create = makeit, + .update = updateit, + .calculate = NULL, + .destroy = killit + }; ws.vws[v].iact = interaction_create (cmd->indep_var); ws.vws[v].cat = categoricals_create (&ws.vws[v].iact, 1, cmd->wv,