Core/Waypoints: Fixed memory leaks happening when loading waypoints with invalid move_type

This commit is contained in:
Shauren
2014-07-31 20:28:32 +02:00
parent 5e825ce9d4
commit daecbd67e8

View File

@@ -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();