diff options
author | Eugene Sandulenko | 2010-07-26 14:21:59 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-07-26 14:21:59 +0000 |
commit | e4bc0c3a18eee3c4a64fc58b55517af510a220c0 (patch) | |
tree | 11e975ffef8b69a3f663ef3ca520adbb86479e03 | |
parent | aea09cb3a0e0fcb5209b568ea2edd2e974e4ad3a (diff) | |
download | scummvm-rg350-e4bc0c3a18eee3c4a64fc58b55517af510a220c0.tar.gz scummvm-rg350-e4bc0c3a18eee3c4a64fc58b55517af510a220c0.tar.bz2 scummvm-rg350-e4bc0c3a18eee3c4a64fc58b55517af510a220c0.zip |
AGI: Fix crash on exit thanks to valgrind
svn-id: r51311
-rw-r--r-- | engines/agi/agi.cpp | 2 | ||||
-rw-r--r-- | engines/agi/sprite.cpp | 3 | ||||
-rw-r--r-- | engines/agi/view.cpp | 3 |
3 files changed, 4 insertions, 4 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 789d6a2193..baefa0ab60 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -343,7 +343,7 @@ int AgiEngine::agiInit() { // clear view table for (i = 0; i < MAX_VIEWTABLE; i++) - memset(&_game.viewTable[i], 0, sizeof(VtEntry)); + memset(&_game.viewTable[i], 0, sizeof(struct VtEntry)); initWords(); diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp index d65fda7f9d..569481d772 100644 --- a/engines/agi/sprite.cpp +++ b/engines/agi/sprite.cpp @@ -245,7 +245,7 @@ void SpritesMgr::objsRestoreArea(Sprite *s) { // WORKAROUND (see ScummVM bug #1945716) // When set.view command is called, current code cannot detect this situation while updating // Thus we force removal of the old sprite - if (s->v->viewReplaced) { + if (s->v && s->v->viewReplaced) { commitBlock(xPos, yPos, xPos + xSize, yPos + ySize); s->v->viewReplaced = false; } @@ -679,6 +679,7 @@ void SpritesMgr::showObj(int n) { s.xSize = c->width; s.ySize = c->height; s.buffer = (uint8 *)malloc(s.xSize * s.ySize); + s.v = 0; objsSaveArea(&s); blitCel(x1, y1, 15, c, _vm->_game.views[n].agi256_2); diff --git a/engines/agi/view.cpp b/engines/agi/view.cpp index 45244bb292..fcca1e2a79 100644 --- a/engines/agi/view.cpp +++ b/engines/agi/view.cpp @@ -157,8 +157,7 @@ int AgiEngine::decodeView(int n) { return errNoLoopsInView; // allocate memory for all views - _game.views[n].loop = (ViewLoop *) - calloc(_game.views[n].numLoops, sizeof(ViewLoop)); + _game.views[n].loop = (ViewLoop *)calloc(_game.views[n].numLoops, sizeof(ViewLoop)); if (_game.views[n].loop == NULL) return errNotEnoughMemory; |