(sona): Fix memory allocation for rad[] and vis[]. The space request

for rad[] and vis[] is too small because it did not consider the size
of the array element.  Broken in rev. 1.15.
This commit is contained in:
Ron Koenderink 2006-01-13 22:56:41 +00:00
parent 45adbdb00e
commit 4898eb65e5

View file

@ -86,7 +86,7 @@ sona(void)
if (!visbuf)
visbuf = malloc((WORLD_Y * (WORLD_X + 1)));
if (!rad) {
rad = malloc(WORLD_Y);
rad = malloc(WORLD_Y * sizeof(char *));
if (rad && radbuf) {
for (x = 0; x < WORLD_Y; x++) {
rad[x] = &radbuf[(WORLD_X + 1) * x];
@ -97,7 +97,7 @@ sona(void)
}
}
if (!vis) {
vis = malloc(WORLD_Y);
vis = malloc(WORLD_Y * sizeof(char *));
if (vis && visbuf) {
for (x = 0; x < WORLD_Y; x++) {
vis[x] = &visbuf[(WORLD_X + 1) * x];