From 4de2871fc0e71fd07824bbe63c12d83af9e0ca12 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 24 Nov 2013 16:21:19 +0000 Subject: (svn r26091) -Fix (r26089): double frees... woospie --- src/openttd.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3-70-g09d2