aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2014-01-18 04:57:29 -0800
committerMachiavelli <machiavelli.trinity@gmail.com>2014-01-18 04:57:29 -0800
commitca6fd8aad29aaa4afddac380ac63124d9e109791 (patch)
tree69fd49670887a11d26d6fec48f79f31e2a45c028 /src
parentc431f463a1f718c5c12de9e1343a5dc71e7e1280 (diff)
parent3a9a634a91331792f238337e51c1162557a23484 (diff)
Merge pull request #11462 from Dehravor/add-event-memleaks
Core/Calendar: Fix memory leaks due to BytebufferException thrown
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index fba575ee84e..86d58c02f05 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -235,18 +235,18 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
recvData.ReadPackedTime(unkPackedTime);
recvData >> flags;
- CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
+ CalendarEvent calendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);
- if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
+ if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
if (Player* creator = ObjectAccessor::FindPlayer(guid))
- calendarEvent->SetGuildId(creator->GetGuildId());
+ calendarEvent.SetGuildId(creator->GetGuildId());
- if (calendarEvent->IsGuildAnnouncement())
+ if (calendarEvent.IsGuildAnnouncement())
{
// 946684800 is 01/01/2000 00:00:00 - default response time
- CalendarInvite* invite = new CalendarInvite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
- sCalendarMgr->AddInvite(calendarEvent, invite);
+ CalendarInvite invite(0, calendarEvent.GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
+ sCalendarMgr->AddInvite(&calendarEvent, &invite);
}
else
{
@@ -262,12 +262,12 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
recvData >> status >> rank;
// 946684800 is 01/01/2000 00:00:00 - default response time
- CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), invitee, guid, 946684800, CalendarInviteStatus(status), CalendarModerationRank(rank), "");
- sCalendarMgr->AddInvite(calendarEvent, invite);
+ CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent.GetEventId(), invitee, guid, 946684800, CalendarInviteStatus(status), CalendarModerationRank(rank), "");
+ sCalendarMgr->AddInvite(&calendarEvent, invite);
}
}
- sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD);
+ sCalendarMgr->AddEvent(new CalendarEvent(calendarEvent, calendarEvent.GetEventId()), CALENDAR_SENDTYPE_ADD);
}
void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)