aboutsummaryrefslogtreecommitdiff
path: root/src/game/ObjectMgr.cpp
diff options
context:
space:
mode:
authorAnubisss <none@none>2009-11-09 20:23:16 +0100
committerAnubisss <none@none>2009-11-09 20:23:16 +0100
commitf032a5ebf5347f60b0825135778f3aa26695888d (patch)
treef89aee4f53f7aad8977def506d3dc69230626682 /src/game/ObjectMgr.cpp
parent8902fd46d9dc7b133f3674a24dad6fec8579de57 (diff)
*Fix memory leakz in reload gm_ticket command.
--HG-- branch : trunk
Diffstat (limited to 'src/game/ObjectMgr.cpp')
-rw-r--r--src/game/ObjectMgr.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index f63074f044b..d5ca4826e38 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -8550,6 +8550,11 @@ uint64 ObjectMgr::GenerateGMTicketId()
void ObjectMgr::LoadGMTickets()
{
+ if(!m_GMTicketList.empty())
+ {
+ for(GmTicketList::const_iterator itr = m_GMTicketList.begin(); itr != m_GMTicketList.end(); ++itr)
+ delete *itr;
+ }
m_GMTicketList.clear();
QueryResult *result = CharacterDatabase.Query( "SELECT guid, playerGuid, name, message, createtime, map, posX, posY, posZ, timestamp, closed, assignedto, comment FROM gm_tickets" );
@@ -8587,11 +8592,19 @@ void ObjectMgr::LoadGMTickets()
} while( result->NextRow() );
+ delete result;
+
result = CharacterDatabase.PQuery("SELECT MAX(guid) from gm_tickets");
- m_GMticketid = (*result)[0].GetUInt64();
+ m_GMticketid = 0;
- sLog.outString(">>> %u GM Tickets loaded from the database.", count);
+ if(result)
+ {
+ Field *fields = result->Fetch();
+ m_GMticketid = fields[0].GetUInt64();
+ }
delete result;
+
+ sLog.outString(">>> %u GM Tickets loaded from the database.", count);
}
void ObjectMgr::AddOrUpdateGMTicket(GM_Ticket &ticket, bool create)