aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-07-31 20:28:32 +0200
committerShauren <shauren.trinity@gmail.com>2014-07-31 20:28:32 +0200
commitdaecbd67e84c03b337d361b3446c09e634c69737 (patch)
tree0233c0eec97df7d3d5494769bb418b692a8be062 /src
parent5e825ce9d48ff02a965919adc4f891defb579c19 (diff)
Core/Waypoints: Fixed memory leaks happening when loading waypoints with invalid move_type
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Movement/Waypoints/WaypointManager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp
index 2820c5dee17..21af63868db 100644
--- a/src/server/game/Movement/Waypoints/WaypointManager.cpp
+++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp
@@ -78,6 +78,7 @@ void WaypointMgr::Load()
if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX)
{
TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp->id);
+ delete wp;
continue;
}
@@ -134,13 +135,14 @@ void WaypointMgr::ReloadPath(uint32 id)
wp->z = z;
wp->orientation = o;
wp->move_type = fields[5].GetUInt32();
-
+
if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX)
{
TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp->id);
+ delete wp;
continue;
}
-
+
wp->delay = fields[6].GetUInt32();
wp->event_id = fields[7].GetUInt32();
wp->event_chance = fields[8].GetUInt8();