(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:
parent
45adbdb00e
commit
4898eb65e5
1 changed files with 2 additions and 2 deletions
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue