summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2017-07-05 20:45:06 -0700
committerOri Bernstein <ori@markovcorp.com>2017-07-18 10:51:21 -0700
commit9fef96e3fc0e48ed435bda6345c0a50b1876a436 (patch)
treed702713e2553aec4aedb02035faae3c172eef88c /6
parentd66406270f0743f0713c35cdcc8f371b58a50004 (diff)
downloadmc-9fef96e3fc0e48ed435bda6345c0a50b1876a436.tar.gz
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.
Diffstat (limited to '6')
-rw-r--r--6/ra.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/6/ra.c b/6/ra.c
index 1f2f037..fc7d047 100644
--- a/6/ra.c
+++ b/6/ra.c
@@ -531,8 +531,8 @@ build(Isel *s)
} 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;