ref: 9fef96e3fc0e48ed435bda6345c0a50b1876a436
parent: d66406270f0743f0713c35cdcc8f371b58a50004
author: Michael Forney <mforney@mforney.org>
date: Wed Jul 5 16:45:06 EDT 2017
Use zalloc to allocate livedense and livesparse Although the data structure works no matter the initial contents of livedense and livesparse, malloc returns a pointer to indeterminate values, and accessing an indeterminate value is undefined behavior. This also avoids spurious valgrind errors when debugging.
--- a/6/ra.c
+++ b/6/ra.c
@@ -531,8 +531,8 @@
} while(0)
/* sparse sets are used here because we iterate them. A lot. */
- livedense = xalloc((maxregid + 1) * sizeof(regid));
- livesparse = xalloc((maxregid + 1) * sizeof(regid));
+ livedense = zalloc((maxregid + 1) * sizeof(regid));
+ livesparse = zalloc((maxregid + 1) * sizeof(regid));
for (i = 0; i < nbb; i++) {
if (!bb[i])
continue;