diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-03-04 10:34:01 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-03-04 13:38:36 +0100 |
commit | 4d779cec5bdac4d1c5ccb6d3299425d466fb483c (patch) | |
tree | 2c7582babaf8aaace64f6cdcf4d00c8d624cf866 /crawl-ref/source/startup.cc | |
parent | e6d166806899c9f580f675bd91360fd2f2605322 (diff) | |
download | crawl-ref-4d779cec5bdac4d1c5ccb6d3299425d466fb483c.tar.gz crawl-ref-4d779cec5bdac4d1c5ccb6d3299425d466fb483c.zip |
Free the cached abyss grid in some cases.
* game exit: placates valgrind
* leaving the Abyss: saves some memory
* game load: could corrupt the Abyss with restart_after_game
The last case is quite convoluted (you'd need to restore a game that was
saved in the Abyss, and previous one had to visit it this session), and
corrupting the Abyss is like trolling /b/, but let's keep saving have
strictly no effect on the game. Someone could scum AKs until getting a
layout they want.
Note that there's an unbounded memory leak as well, in WorleyLayout: it
doesn't free source layouts passed to it. These are sometimes malloced,
sometimes references to static objects, so it's not as simple a matter.
Diffstat (limited to 'crawl-ref/source/startup.cc')
-rw-r--r-- | crawl-ref/source/startup.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crawl-ref/source/startup.cc b/crawl-ref/source/startup.cc index 3e8f35dc24..2f1f7a5253 100644 --- a/crawl-ref/source/startup.cc +++ b/crawl-ref/source/startup.cc @@ -204,6 +204,8 @@ static void _post_init(bool newc) crawl_state.last_type = crawl_state.type; crawl_state.last_game_won = false; + destroy_abyss(); + calc_hp(); calc_mp(); if (you.form != TRAN_LICH) |