logistic.c: Fix read from uninitialised memory. 20121030030503/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 30 Oct 2012 05:54:09 +0000 (06:54 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 30 Oct 2012 05:56:49 +0000 (06:56 +0100)
Found-by valgrind.

src/language/stats/logistic.c

index fb9a26521a7273a948641de57fc07a0438d0c020..93472e0294f78243aff4b7c41a2258deaf4e7bee 100644 (file)
@@ -390,10 +390,10 @@ beta_hat_initial (const struct lr_spec *cmd, struct lr_result *res, struct caser
            }
        }
 
-      if (value_equal (&res->y0, depval, width))
+      if (v0set && value_equal (&res->y0, depval, width))
          sumA += weight;
 
-      if (value_equal (&res->y1, depval, width))
+      if (v1set && value_equal (&res->y1, depval, width))
          sumB += weight;