TrinityCore/TrinityCore — pull request #11462 by Dehravor (2014-01-18 11:12:14+00:00)
Title: Calendar memory leaks

1.: http://pastebin.com/3Ja8VRYz
The CalendarEvent object is created before the packet is fully read, therefore if a ByteBufferException occurs, it won't be deallocated. I couldn't find a better solution other than this copy thing at the end, because both CalendarMgr::AddEvent and CalendarMgr::AddInvite depend on each other.

2.: http://pastebin.com/GBKUFNd9
When a guild announcement is created, the initial invitation is only used for a single packet send in CalendarMgr::AddEvent, and it won't be stored in the invite container, so no deallocation happens when sCalendarMgr is destructed.

I'm not sure if this is the most efficient way to fix them, any advice is welcome.