diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 236a52137..02329bdb9 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3370,17 +3370,13 @@ void P_FreeLevelData () sectors = NULL; numsectors = 0; // needed for the pointer cleanup code } - if (gamenodes && gamenodes!=nodes) + if (gamenodes != NULL && gamenodes != nodes) { - delete [] gamenodes; - gamenodes = NULL; - numgamenodes = 0; + delete[] gamenodes; } - if (gamesubsectors && gamesubsectors!=subsectors) + if (gamesubsectors != NULL && gamesubsectors != subsectors) { - delete [] gamesubsectors; - gamesubsectors = NULL; - numgamesubsectors = 0; + delete[] gamesubsectors; } if (subsectors != NULL) { @@ -3392,13 +3388,15 @@ void P_FreeLevelData () } } delete[] subsectors; - subsectors = NULL; } if (nodes != NULL) { delete[] nodes; - nodes = NULL; } + subsectors = gamesubsectors = NULL; + numsubsectors = numgamesubsectors = 0; + nodes = gamenodes = NULL; + numnodes = numgamenodes = 0; if (lines != NULL) { delete[] lines;