Skip to content

Commit

Permalink
Common, Engine: fixed couple of memory leaks
Browse files Browse the repository at this point in the history
Found by Janet Gilbert.
  • Loading branch information
ivan-mogilko committed Oct 27, 2016
1 parent 350ee86 commit c5188b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Common/gui/guilistbox.cpp
Expand Up @@ -68,6 +68,8 @@ void GUIListBox::ReadFromFile(Stream *in, GuiVersion gui_version)
int a, i;
char tempbuf[300];

Clear();

GUIObject::ReadFromFile(in, gui_version);
// MACPORT FIXES: swap
in->ReadArrayOfInt32(&numItems, 11);
Expand Down
5 changes: 5 additions & 0 deletions Engine/ac/game.cpp
Expand Up @@ -2205,6 +2205,11 @@ int restore_game_data (Stream *in, const char *nametouse, SavedGameVersion svg_v

ReadGameSetupStructBase_Aligned(in);

// Delete unneeded data
// TODO: reorganize this (may be solved by optimizing safe format too)
delete [] game.load_messages;
game.load_messages = NULL;

if (game.numdialog!=numdiwas)
quit("!Restore_Game: Game has changed (dlg), unable to restore");
if ((numchwas != game.numcharacters) || (numinvwas != game.numinvitems))
Expand Down

0 comments on commit c5188b6

Please sign in to comment.