浏览代码

CPathfinderHelper: fix memory leak

Arseniy Shestakov 9 年之前
父节点
当前提交
b4a35f9c62
共有 2 个文件被更改,包括 7 次插入0 次删除
  1. 6 0
      lib/CPathfinder.cpp
  2. 1 0
      lib/CPathfinder.h

+ 6 - 0
lib/CPathfinder.cpp

@@ -929,6 +929,12 @@ CPathfinderHelper::CPathfinderHelper(const CGHeroInstance * Hero, const CPathfin
 	updateTurnInfo();
 }
 
+CPathfinderHelper::~CPathfinderHelper()
+{
+	for(auto ti : turnsInfo)
+		delete ti;
+}
+
 void CPathfinderHelper::updateTurnInfo(const int Turn)
 {
 	if(turn != Turn)

+ 1 - 0
lib/CPathfinder.h

@@ -263,6 +263,7 @@ class DLL_LINKAGE CPathfinderHelper
 {
 public:
 	CPathfinderHelper(const CGHeroInstance * Hero, const CPathfinder::PathfinderOptions & Options);
+	~CPathfinderHelper();
 	void updateTurnInfo(const int turn = 0);
 	bool isLayerAvailable(const EPathfindingLayer layer) const;
 	const TurnInfo * getTurnInfo() const;