diff options
author | Eugene Sandulenko | 2016-11-13 16:36:18 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-11-13 16:36:43 +0100 |
commit | 43438fbe1365115f1a4df1a452d14677fca3c86b (patch) | |
tree | 586473b75e63f5c50f34b07c8957a60795d351ba | |
parent | a22e3bceac828177e720abc72773424e8a29bc72 (diff) | |
download | scummvm-rg350-43438fbe1365115f1a4df1a452d14677fca3c86b.tar.gz scummvm-rg350-43438fbe1365115f1a4df1a452d14677fca3c86b.tar.bz2 scummvm-rg350-43438fbe1365115f1a4df1a452d14677fca3c86b.zip |
CHEWY: Plug memory leaks
-rw-r--r-- | backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 8 | ||||
-rw-r--r-- | engines/chewy/graphics.cpp | 3 | ||||
-rw-r--r-- | engines/chewy/sound.cpp | 4 |
3 files changed, 10 insertions, 5 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 21e334d242..6cd5a47e1c 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -345,7 +345,7 @@ OSystem::TransactionError SurfaceSdlGraphicsManager::endGFXTransaction() { #if SDL_VERSION_ATLEAST(2, 0, 0) } else if (_videoMode.filtering != _oldVideoMode.filtering) { errors |= OSystem::kTransactionFilteringFailed; - + _videoMode.filtering = _oldVideoMode.filtering; #endif #ifdef USE_RGB_COLOR @@ -2350,7 +2350,7 @@ bool SurfaceSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) { internUpdateScreen(); return true; } - + #if SDL_VERSION_ATLEAST(2, 0, 0) // Ctrl-Alt-f toggles filtering if (key == 'f') { @@ -2595,7 +2595,7 @@ void SurfaceSdlGraphicsManager::recreateScreenTexture() { return; SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, _videoMode.filtering ? "linear" : "nearest"); - + SDL_Texture *oldTexture = _screenTexture; _screenTexture = SDL_CreateTexture(_renderer, SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STREAMING, _videoMode.hardwareWidth, _videoMode.hardwareHeight); if (_screenTexture) @@ -2627,7 +2627,7 @@ SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height, SDL_GetWindowSize(_window->getSDLWindow(), &_windowWidth, &_windowHeight); setWindowResolution(_windowWidth, _windowHeight); - + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, _videoMode.filtering ? "linear" : "nearest"); _screenTexture = SDL_CreateTexture(_renderer, SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STREAMING, width, height); diff --git a/engines/chewy/graphics.cpp b/engines/chewy/graphics.cpp index 07a3abe435..54a731fd3a 100644 --- a/engines/chewy/graphics.cpp +++ b/engines/chewy/graphics.cpp @@ -140,6 +140,9 @@ void Graphics::playVideo(uint num) { g_system->getPaletteManager()->setPalette(curPalette, 0, 256); _vm->_cursor->showCursor(); + + delete videoResource; + delete cfoDecoder; } } // End of namespace Chewy diff --git a/engines/chewy/sound.cpp b/engines/chewy/sound.cpp index 36f2d63073..843387d1c8 100644 --- a/engines/chewy/sound.cpp +++ b/engines/chewy/sound.cpp @@ -100,7 +100,7 @@ void Sound::playMusic(int num, bool loop) { uint32 musicNum = _soundRes->getChunkCount() - 1 - num; Chunk *chunk = _soundRes->getChunk(musicNum); byte *data = _soundRes->getChunkData(musicNum); - + playMusic(data, chunk->size, loop); delete[] data; @@ -252,6 +252,8 @@ void Sound::convertTMFToMod(byte *tmfData, uint32 tmfSize, byte *modData, uint32 // TODO: 31 bytes instrument positions // TODO: notes + + free(modData); } } // End of namespace Chewy |