From 6330c1e5fdced523e1e245eac67754cd2b519c32 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Mon, 30 Jul 2012 20:39:04 +0200 Subject: WINTERMUTE: Fix a few memory-leaks --- engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines/wintermute/base/gfx') diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index c449f6471c..9f0e605f39 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -139,6 +139,7 @@ bool BaseSurfaceOSystem::finishLoad() { // convert 32-bit BMPs to 24-bit or they appear totally transparent (does any app actually write alpha in BMP properly?) // Well, actually, we don't convert via 24-bit as the color-key application overwrites the Alpha-channel anyhow. + _surface->free(); delete _surface; if (_filename.hasSuffix(".bmp") && image->getSurface()->format.bytesPerPixel == 4) { _surface = image->getSurface()->convertTo(g_system->getScreenFormat(), image->getPalette()); @@ -412,6 +413,7 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAlpha) { _loaded = true; + _surface->free(); _surface->copyFrom(surface); _hasAlpha = hasAlpha; BaseRenderOSystem *renderer = static_cast(_gameRef->_renderer); -- cgit v1.2.3