aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-02-22 16:09:34 +0000
committerTorbjörn Andersson2004-02-22 16:09:34 +0000
commit95831a2d5b7ad649fca37772a98f78f49c90b692 (patch)
treecbd64269f24e7481b20d094236747ce5091a46a2
parent371cfa810f5ceaa7f05a1b0fd670dfa0f0ace5e1 (diff)
downloadscummvm-rg350-95831a2d5b7ad649fca37772a98f78f49c90b692.tar.gz
scummvm-rg350-95831a2d5b7ad649fca37772a98f78f49c90b692.tar.bz2
scummvm-rg350-95831a2d5b7ad649fca37772a98f78f49c90b692.zip
Free _screenBuf and _screenGrid before allocating new ones.
svn-id: r12990
-rw-r--r--sword1/screen.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/sword1/screen.cpp b/sword1/screen.cpp
index c5c1dd80ac..dba1a77fce 100644
--- a/sword1/screen.cpp
+++ b/sword1/screen.cpp
@@ -265,6 +265,10 @@ void Screen::newScreen(uint32 screen) {
Logic::_scriptVars[SCROLL_OFFSET_X] = 0;
Logic::_scriptVars[SCROLL_OFFSET_Y] = 0;
}
+ if (_screenBuf)
+ free(_screenBuf);
+ if (_screenGrid)
+ free(_screenGrid);
_screenBuf = (uint8*)malloc(_scrnSizeX * _scrnSizeY);
_screenGrid = (uint8*)malloc(_gridSizeX * _gridSizeY);
memset(_screenGrid, 0, _gridSizeX * _gridSizeY);