Release memory properly at exit, and fixed a new/free mismatch

This commit is contained in:
Olivier Teulière 2006-01-29 12:40:49 +00:00
parent bb5a17d0f1
commit 1e13d6bfad
2 changed files with 6 additions and 2 deletions

View file

@ -60,7 +60,7 @@ wchar_t *rl_gets()
}
if (wline_read)
{
free(wline_read);
delete[] wline_read;
wline_read = NULL;
}
@ -1005,7 +1005,7 @@ int main(int argc, char *argv[])
if (line_read)
free(line_read);
if (wline_read)
free(wline_read);
delete[] wline_read;
return 0;
}

View file

@ -54,6 +54,7 @@ CursesIntf::CursesIntf(WINDOW *win, Game& iGame)
CursesIntf::~CursesIntf()
{
GameFactory::Instance()->releaseGame(*m_game);
GameFactory::Destroy();
}
@ -835,7 +836,10 @@ int main(int argc, char ** argv)
Game *game = GameFactory::Instance()->createFromCmdLine(argc, argv);
if (game == NULL)
{
GameFactory::Destroy();
return 1;
}
game->start();