mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Map: add missing sresize in new_game_desc().
Every time we append to the string 'ret', we check first that there's enough space, and realloc it larger if it's getting close to full. Except that I missed one case at the join between the two parts of the encoding. (Spotted because apparently on someone's build platform this led to a compiler warning that 'ret' might be null. I think _that's_ not a serious worry, but the missing resize was definitely unintentional.)
This commit is contained in:
4
map.c
4
map.c
@ -1659,6 +1659,10 @@ static char *new_game_desc(const game_params *params, random_state *rs,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (retlen + 10 >= retsize) {
|
||||||
|
retsize = retlen + 256;
|
||||||
|
ret = sresize(ret, retsize, char);
|
||||||
|
}
|
||||||
ret[retlen++] = 'a'-1 + run;
|
ret[retlen++] = 'a'-1 + run;
|
||||||
ret[retlen++] = ',';
|
ret[retlen++] = ',';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user