From 74b823d6dc43ff9735d4ebeab1e2c70140f5958b Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 5 Jan 2012 20:48:05 +0000 Subject: [PATCH] trivial tweaks: some NULLing pointer after freeing them; move the 'too much mirrors' check one 'if' down since mirrors are only created when the condition holds git-svn-id: https://svn.eduke32.com/eduke32@2233 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 5 +++-- polymer/eduke32/source/gamedef.c | 1 + polymer/eduke32/source/premap.c | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index e3cc7310b..e89208f48 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -10156,8 +10156,9 @@ CLEAN_DIRECTORY: } for (i=0; i < g_defModulesNum; ++i) - Bfree (g_defModules[i]); - Bfree (g_defModules); + Bfree(g_defModules[i]); + Bfree(g_defModules); + g_defModules = NULL; if (numplayers == 1 && boardfilename[0] != 0) { diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index b45d4e853..184ccb126 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -5799,6 +5799,7 @@ void C_Compile(const char *filenam) Bfree(g_scriptModules[i]); } Bfree(g_scriptModules); + g_scriptModules = NULL; flushlogwindow = 1; diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 3b8400031..5a36e1205 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -1309,10 +1309,11 @@ static inline void prelevel(char g) { j = wal->nextsector; - if (g_mirrorCount > 63) - G_GameExit("\nToo many mirrors (64 max.)"); if ((j >= 0) && sector[j].ceilingpicnum != MIRROR) { + if (g_mirrorCount > 63) + G_GameExit("\nToo many mirrors (64 max.)"); + sector[j].ceilingpicnum = MIRROR; sector[j].floorpicnum = MIRROR; g_mirrorWall[g_mirrorCount] = i;