Browse Source

Fix memory leaks in library

Ivan Savenko 1 year ago
parent
commit
d4496c81f9
2 changed files with 3 additions and 0 deletions
  1. 1 0
      lib/CTownHandler.cpp
  2. 2 0
      lib/gameState/CGameState.cpp

+ 1 - 0
lib/CTownHandler.cpp

@@ -318,6 +318,7 @@ CTownHandler::CTownHandler():
 CTownHandler::~CTownHandler()
 {
 	delete randomTown;
+	delete randomFaction;
 }
 
 JsonNode readBuilding(CLegacyConfigParser & parser)

+ 2 - 0
lib/gameState/CGameState.cpp

@@ -166,6 +166,8 @@ CGameState::~CGameState()
 	// explicitly delete all ongoing battles first - BattleInfo destructor requires valid CGameState
 	currentBattles.clear();
 	map.dellNull();
+	scenarioOps.dellNull();
+	initialOpts.dellNull();
 }
 
 void CGameState::preInit(Services * services)