mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 13:47:23 +01:00
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
This commit is contained in:
@@ -53,7 +53,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
|
||||
//load not built in channel if saved
|
||||
std::string _name(name);
|
||||
CharacterDatabase.escape_string(_name);
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT m_name, m_team, m_announce, m_moderate, m_password, BannedList FROM channels WHERE m_name = '%s' AND m_team = '%u'", _name.c_str(), m_Team);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT m_name, m_team, m_announce, m_moderate, m_password, BannedList FROM channels WHERE m_name = '%s' AND m_team = '%u'", _name.c_str(), m_Team);
|
||||
if (result)//load
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
@@ -64,8 +64,6 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
|
||||
m_password = fields[4].GetString();
|
||||
const char* db_BannedList = fields[5].GetString();
|
||||
|
||||
delete result;
|
||||
|
||||
m_IsSaved = true;
|
||||
|
||||
if (db_BannedList)
|
||||
|
||||
Reference in New Issue
Block a user