static void update_worldstate_file()
{
char * f_name = "update_worldstate_file()";
- char path_tmp[strlen(s[PATH_WORLDSTATE]) + strlen(s[PATH_SUFFIX_TMP]) + 1];
+ uint16_t size = strlen(s[PATH_WORLDSTATE]) + strlen(s[PATH_SUFFIX_TMP]) + 1;
+ char * path_tmp = try_malloc(size, f_name);
sprintf(path_tmp, "%s%s", s[PATH_WORLDSTATE], s[PATH_SUFFIX_TMP]);
FILE * file = try_fopen(path_tmp, "w", f_name);
struct Thing * player = get_player();
try_fwrite(world.log, strlen(world.log), 1, file, f_name);
}
try_fclose_unlink_rename(file, path_tmp, s[PATH_WORLDSTATE], f_name);
+ free(path_tmp);
set_cleanup_flag(CLEANUP_WORLDSTATE);
char * dot = ".\n";;
try_fwrite(dot, strlen(dot), 1, world.file_out, f_name);
memset(visible_map, ' ', map_size);
if (player->fov_map) /* May fail if player thing was created / positioned */
{ /* by god command after turning off FOV building. */
- uint16_t pos_i;
+ uint32_t pos_i;
for (pos_i = 0; pos_i < map_size; pos_i++)
{
if (player->fov_map[pos_i] & VISIBLE)