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:
1 parent
c784110d87
commit
d9cb070215
76 files changed
+458
-1108
No files matched your search
@@ -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