diff options
author | Max Horn | 2008-03-26 19:29:33 +0000 |
---|---|---|
committer | Max Horn | 2008-03-26 19:29:33 +0000 |
commit | b0c6a12c81c949c7f61b6639b509dad2b4fbb862 (patch) | |
tree | a20a4c62707dee6bad3a45fc2b3409d86c7377ce | |
parent | afed582280195bc0165e93af7003aadea6438c89 (diff) | |
download | scummvm-rg350-b0c6a12c81c949c7f61b6639b509dad2b4fbb862.tar.gz scummvm-rg350-b0c6a12c81c949c7f61b6639b509dad2b4fbb862.tar.bz2 scummvm-rg350-b0c6a12c81c949c7f61b6639b509dad2b4fbb862.zip |
Modified Patch #1925352: Memory leak fixes
svn-id: r31244
-rw-r--r-- | backends/platform/sdl/graphics.cpp | 1 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 14 | ||||
-rw-r--r-- | base/main.cpp | 4 | ||||
-rw-r--r-- | common/singleton.h | 4 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 3 | ||||
-rw-r--r-- | graphics/scaler.cpp | 6 | ||||
-rw-r--r-- | graphics/scaler.h | 1 | ||||
-rw-r--r-- | sound/softsynth/adlib.cpp | 1 |
8 files changed, 33 insertions, 1 deletions
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index b9d1e37c05..4a5c143712 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -459,6 +459,7 @@ void OSystem_SDL::unloadGFXMode() { _osdSurface = NULL; } #endif + DestroyScalers(); } void OSystem_SDL::hotswapGFXMode() { diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 4394b6c253..d5db665f21 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -309,9 +309,23 @@ void OSystem_SDL::quit() { if (_joystick) SDL_JoystickClose(_joystick); SDL_ShowCursor(SDL_ENABLE); + + SDL_RemoveTimer(_timerID); + SDL_CloseAudio(); + + free(_dirtyChecksums); + free(_currentPalette); + free(_cursorPalette); + free(_mouseData); + + delete _savefile; + delete _mixer; + delete _timer; + SDL_Quit(); delete getEventManager(); + exit(0); } diff --git a/base/main.cpp b/base/main.cpp index 4e330c0178..a3e1c0fe5d 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -329,6 +329,10 @@ extern "C" int scummvm_main(int argc, char *argv[]) { launcherDialog(system); } + PluginManager::instance().unloadPluginsExcept(NULL); + PluginManager::instance().destroy(); + ConfMan.destroy(); + delete g_gui.theme(); return 0; } diff --git a/common/singleton.h b/common/singleton.h index 56039afb37..849bf208bb 100644 --- a/common/singleton.h +++ b/common/singleton.h @@ -71,6 +71,10 @@ public: _singleton = T::makeInstance(); return *_singleton; } + virtual void destroy() { + delete _singleton; + _singleton = 0; + } protected: Singleton<T>() { } #ifdef __SYMBIAN32__ diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 50978f817d..3a93fae0fa 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -885,6 +885,8 @@ ScummEngine_v7::~ScummEngine_v7() { delete _splayer; } + delete _insane; + free(_languageBuffer); free(_languageIndex); } @@ -1201,6 +1203,7 @@ void ScummEngine::setupScumm() { _fmtownsBuf = (byte *)malloc(_screenWidth * _textSurfaceMultiplier * _screenHeight * _textSurfaceMultiplier); } + free(_compositeBuf); _compositeBuf = (byte *)malloc(_screenWidth * _textSurfaceMultiplier * _screenHeight * _textSurfaceMultiplier); } diff --git a/graphics/scaler.cpp b/graphics/scaler.cpp index f460124c62..d80003761b 100644 --- a/graphics/scaler.cpp +++ b/graphics/scaler.cpp @@ -27,7 +27,6 @@ #include "graphics/scaler/scalebit.h" #include "common/util.h" - int gBitFormat = 565; #ifndef DISABLE_HQ_SCALERS @@ -112,6 +111,11 @@ void InitScalers(uint32 BitFormat) { #endif } +void DestroyScalers(){ + free(RGBtoYUV); + free(LUT16to32); +} + /** * Trivial 'scaler' - in fact it doesn't do any scaling but just copies the diff --git a/graphics/scaler.h b/graphics/scaler.h index ccd2c3991a..2cf3f66239 100644 --- a/graphics/scaler.h +++ b/graphics/scaler.h @@ -29,6 +29,7 @@ #include "graphics/surface.h" extern void InitScalers(uint32 BitFormat); +extern void DestroyScalers(); typedef void ScalerProc(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height); diff --git a/sound/softsynth/adlib.cpp b/sound/softsynth/adlib.cpp index 90f411b1df..1cf4c2b179 100644 --- a/sound/softsynth/adlib.cpp +++ b/sound/softsynth/adlib.cpp @@ -871,6 +871,7 @@ void MidiDriver_ADLIB::close() { } // Turn off the OPL emulation + OPLDestroy(_opl); // YM3812Shutdown(); free(_adlib_reg_cache); |