Fix integer overflow in layer_resize in map_engine.c (#268)

* Fix integer overflow in layer_resize in map_engine.c

There's a buffer overflow bug in the function layer_resize. It allocates
a buffer `tilemap` with size `x_size * y_size * sizeof(struct map_tile)`.
But it didn't check for integer overflow, so if x_size and y_size are
very large, it's possible that the buffer size is smaller than needed,
causing a buffer overflow later.

PoC: `SetLayerSize(0, 0x7FFFFFFF, 0x7FFFFFFF);`

* move malloc to a separate line
map_engine_uninit(void)
{
	int i;

	console_log(1, "shutting down map engine subsystem");

	vector_free(s_person_list);

	for (i = 0; i < s_num_deferreds; ++i)
		script_unref(s_deferreds[i].script);
	free(s_deferreds);
	for (i = 0; i < MAP_SCRIPT_MAX; ++i)
		script_unref(s_def_map_scripts[i]);
	script_unref(s_update_script);
	script_unref(s_render_script);
	free_map(s_map);
	free(s_players);

	for (i = 0; i < s_num_persons; ++i)
		free_person(s_persons[i]);
	for (i = 0; i < PERSON_SCRIPT_MAX; ++i)
		script_unref(s_def_person_scripts[i]);
	free(s_persons);

	mixer_unref(s_bgm_mixer);

	audio_uninit();
}

map_engine_uninit(void)
{
	int i;

	console_log(1, "shutting down map engine subsystem");

	vector_free(s_person_list);

	for (i = 0; i < s_num_deferreds; ++i)
		script_unref(s_deferreds[i].script);
	free(s_deferreds);
	for (i = 0; i < MAP_SCRIPT_MAX; ++i)
		script_unref(s_def_map_scripts[i]);
	script_unref(s_update_script);
	script_unref(s_render_script);
	free_map(s_map);
	free(s_players);

	for (i = 0; i < s_num_persons; ++i)
		free_person(s_persons[i]);
	for (i = 0; i < PERSON_SCRIPT_MAX; ++i)
		script_unref(s_def_person_scripts[i]);
	free(s_persons);

	mixer_unref(s_bgm_mixer);

	audio_uninit();
}
