From a74fd218478656a376773f97f79f9c233f7cb4c3 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 17 Oct 2009 17:59:09 +0000 Subject: SCI: Fix delete/free mismatches svn-id: r45196 --- engines/sci/engine/savegame.cpp | 2 +- engines/sci/gui/gui_cursor.cpp | 2 +- engines/sci/sfx/songlib.cpp | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 9d663fc1cf..177659583f 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -483,7 +483,7 @@ static void sync_songlib_t(Common::Serializer &s, SongLibrary &obj) { if (s.isLoading()) { obj._lib = 0; while (songcount--) { - Song *newsong = (Song *)calloc(1, sizeof(Song)); + Song *newsong = new Song; sync_song_t(s, *newsong); obj.addSong(newsong); } diff --git a/engines/sci/gui/gui_cursor.cpp b/engines/sci/gui/gui_cursor.cpp index 81b390e3b6..e4399754d8 100644 --- a/engines/sci/gui/gui_cursor.cpp +++ b/engines/sci/gui/gui_cursor.cpp @@ -109,7 +109,7 @@ void SciGuiCursor::setShape(GuiResourceId resourceId) { CursorMan.replaceCursor(rawBitmap, SCI_CURSOR_SCI0_HEIGHTWIDTH, SCI_CURSOR_SCI0_HEIGHTWIDTH, hotspot.x, hotspot.y, SCI_CURSOR_SCI0_TRANSPARENCYCOLOR); CursorMan.showMouse(true); - delete rawBitmap; + delete[] rawBitmap; } void SciGuiCursor::setView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot) { diff --git a/engines/sci/sfx/songlib.cpp b/engines/sci/sfx/songlib.cpp index 7cf26ff453..1317988e2f 100644 --- a/engines/sci/sfx/songlib.cpp +++ b/engines/sci/sfx/songlib.cpp @@ -32,6 +32,7 @@ namespace Sci { Song::Song() { _handle = 0; + _resourceNum = 0; _priority = 0; _status = SOUND_STATUS_STOPPED; @@ -51,6 +52,7 @@ Song::Song() { Song::Song(SongHandle handle, SongIterator *it, int priority) { _handle = handle; + _resourceNum = 0; _priority = priority; _status = SOUND_STATUS_STOPPED; -- cgit v1.2.3