summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-11-24 16:21:19 +0000
committerrubidium <rubidium@openttd.org>2013-11-24 16:21:19 +0000
commit4de2871fc0e71fd07824bbe63c12d83af9e0ca12 (patch)
tree651be78aa21bd4f7eab2ce4f6fc6b2c884c1be53
parentc54a70cce81e382c43d085988f0762f60b6a19da (diff)
downloadopenttd-4de2871fc0e71fd07824bbe63c12d83af9e0ca12.tar.xz
(svn r26091) -Fix (r26089): double frees... woospie
-rw-r--r--src/openttd.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 1f8b43ef8..c5d4600c9 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -798,7 +798,10 @@ int openttd_main(int argc, char *argv[])
}
#endif /* ENABLE_NETWORK */
- if (!HandleBootstrap()) goto exit;
+ if (!HandleBootstrap()) {
+ ShutdownGame();
+ goto exit_bootstrap;
+ }
_video_driver->ClaimMousePointer();
@@ -874,29 +877,33 @@ int openttd_main(int argc, char *argv[])
SaveToHighScore();
}
-exit:
/* Reset windowing system, stop drivers, free used memory, ... */
ShutdownGame();
+ goto exit_normal;
exit_noshutdown:
- free(BaseGraphics::ini_set);
- free(BaseSounds::ini_set);
- free(BaseMusic::ini_set);
-
+ /* These three are normally freed before bootstrap. */
free(graphics_set);
+ free(videodriver);
+ free(blitter);
+
+exit_bootstrap:
+ /* These are normally freed before exit, but after bootstrap. */
free(sounds_set);
free(music_set);
+ free(musicdriver);
+ free(sounddriver);
+
+exit_normal:
+ free(BaseGraphics::ini_set);
+ free(BaseSounds::ini_set);
+ free(BaseMusic::ini_set);
free(_ini_musicdriver);
free(_ini_sounddriver);
free(_ini_videodriver);
free(_ini_blitter);
- free(musicdriver);
- free(sounddriver);
- free(videodriver);
- free(blitter);
-
return ret;
}