diff options
author | Anubisss <none@none> | 2010-01-23 14:45:58 +0100 |
---|---|---|
committer | Anubisss <none@none> | 2010-01-23 14:45:58 +0100 |
commit | d9cb0702158fd045285f2c0a904cb31a45a3864a (patch) | |
tree | cdc6a7c6a83c6eea603ae296a653fb9f04945aad /src/game/Transports.cpp | |
parent | c784110d87666579f18620a98e1e57118db4a9cf (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/Transports.cpp')
-rw-r--r-- | src/game/Transports.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index f0efef5ee20..8e7eb82597e 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -33,7 +33,7 @@ void MapManager::LoadTransports() { - QueryResult *result = WorldDatabase.Query("SELECT entry, name, period FROM transports"); + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, name, period FROM transports"); uint32 count = 0; @@ -111,7 +111,6 @@ void MapManager::LoadTransports() //t->GetMap()->Add<GameObject>((GameObject *)t); ++count; } while(result->NextRow()); - delete result; sLog.outString(); sLog.outString( ">> Loaded %u transports", count ); @@ -130,8 +129,6 @@ void MapManager::LoadTransports() sLog.outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports DON'T must have any records in `gameobject` or its behavior will be unpredictable/bugged.",entry,name.c_str(),guid); } while(result->NextRow()); - - delete result; } } |