aboutsummaryrefslogtreecommitdiff
path: root/src/game/WaypointManager.cpp
diff options
context:
space:
mode:
authorAnubisss <none@none>2010-01-23 14:45:58 +0100
committerAnubisss <none@none>2010-01-23 14:45:58 +0100
commitd9cb0702158fd045285f2c0a904cb31a45a3864a (patch)
treecdc6a7c6a83c6eea603ae296a653fb9f04945aad /src/game/WaypointManager.cpp
parentc784110d87666579f18620a98e1e57118db4a9cf (diff)
Implement QueryResult_AutoPtr type which is ACE's reference counted auto_ptr(ACE_Refcounted_Auto_Ptr) for QueryResult pointers.
Use this auto_ptr for every DB queries(except QueryNamedResult yet). This patch guarantees NO memory leaks from QueryResult pointers. Thanks to raczman for the idea and for the helping to make this patch. --HG-- branch : trunk
Diffstat (limited to 'src/game/WaypointManager.cpp')
-rw-r--r--src/game/WaypointManager.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp
index f4d14eb00d1..61d2b041092 100644
--- a/src/game/WaypointManager.cpp
+++ b/src/game/WaypointManager.cpp
@@ -34,7 +34,7 @@ void WaypointStore::Free()
void WaypointStore::Load()
{
- QueryResult *result = WorldDatabase.PQuery("SELECT COUNT(id) FROM waypoint_data");
+ QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT COUNT(id) FROM waypoint_data");
if (!result)
{
sLog.outError("an error occured while loading the table `waypoint_data` (maybe it doesn't exist ?)");
@@ -42,7 +42,6 @@ void WaypointStore::Load()
}
records = (*result)[0].GetUInt32();
- delete result;
result = WorldDatabase.PQuery("SELECT id,point,position_x,position_y,position_z,move_flag,delay,action,action_chance FROM waypoint_data ORDER BY id, point");
if(!result)
@@ -96,7 +95,6 @@ void WaypointStore::Load()
} while(result->NextRow()) ;
- delete result;
sLog.outString();
sLog.outString(">> Loaded %u waypoints", count);
}
@@ -106,7 +104,7 @@ void WaypointStore::UpdatePath(uint32 id)
if(waypoint_map.find(id)!= waypoint_map.end())
waypoint_map[id]->clear();
- QueryResult *result;
+ QueryResult_AutoPtr result;
result = WorldDatabase.PQuery("SELECT id,point,position_x,position_y,position_z,move_flag,delay,action,action_chance FROM waypoint_data WHERE id = %u ORDER BY point", id);
@@ -147,7 +145,5 @@ void WaypointStore::UpdatePath(uint32 id)
while (result->NextRow());
waypoint_map[id] = path_data;
-
- delete result;
}