Modified Patch : Memory leak fixes

svn-id: r31244
This commit is contained in:
Max Horn 2008-03-26 19:29:33 +00:00
parent afed582280
commit b0c6a12c81
8 changed files with 33 additions and 1 deletions
backends/platform/sdl
base
common
engines/scumm
graphics
sound/softsynth

@ -459,6 +459,7 @@ void OSystem_SDL::unloadGFXMode() {
_osdSurface = NULL;
}
#endif
DestroyScalers();
}
void OSystem_SDL::hotswapGFXMode() {

@ -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);
}

@ -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;
}

@ -71,6 +71,10 @@ public:
_singleton = T::makeInstance();
return *_singleton;
}
virtual void destroy() {
delete _singleton;
_singleton = 0;
}
protected:
Singleton<T>() { }
#ifdef __SYMBIAN32__

@ -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);
}

@ -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

@ -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);

@ -871,6 +871,7 @@ void MidiDriver_ADLIB::close() {
}
// Turn off the OPL emulation
OPLDestroy(_opl);
// YM3812Shutdown();
free(_adlib_reg_cache);