From 1b6b4c5c085ea1e359dbfeef3aacc320dcdca536 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 3 Jan 2010 18:37:13 +0000 Subject: [PATCH] Fixed memory leak (as reported by eriktorbjorn) svn-id: r46938 --- engines/sci/gui/gui_gfx.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 55d9dcedeac..18d925e3cfb 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -318,14 +318,14 @@ void SciGuiGfx::BitsFree(GuiMemoryHandle memoryHandle) { } void SciGuiGfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId) { - SciGuiPicture *picture; + SciGuiPicture *picture = new SciGuiPicture(_resMan, this, _screen, _palette, pictureId); - picture = new SciGuiPicture(_resMan, this, _screen, _palette, pictureId); // do we add to a picture? if not -> clear screen with white - if (!addToFlag) { + if (!addToFlag) ClearScreen(_screen->_colorWhite); - } + picture->draw(animationNr, mirroredFlag, addToFlag, paletteId); + delete picture; } // This one is the only one that updates screen!