* fixed some memleaks at shutdown. thx to bLuma for patch!

This commit is contained in:
False.Genesis 2007-10-19 20:01:15 +00:00
parent 3717c1cd22
commit 8d261e5da0
5 changed files with 29 additions and 2 deletions

View File

@ -43,3 +43,12 @@ DefList *ListStorage::Get(std::string s)
DefList *l = GetNoCreate(s);
return l ? l : _Create(s);
}
ListStorage::~ListStorage()
{
for(DefListMap::iterator it = _storage.begin(); it != _storage.end();)
{
delete it->second;
_storage.erase(it++);
}
}

View File

@ -11,6 +11,8 @@ typedef std::map<std::string,DefList*> DefListMap;
class ListStorage
{
public:
~ListStorage();
bool Exists(std::string);
void Delete(std::string);
DefList *Get(std::string);

View File

@ -13,6 +13,14 @@
// increase this number whenever you change something that makes old files unusable
uint32 ITEMPROTOTYPES_CACHE_VERSION = 0x00000001;
PlayerNameCache::~PlayerNameCache()
{
for(std::vector<PlayerNameCacheItem*>::iterator i=_cache.begin(); i!=_cache.end(); i++)
{
delete *i;
}
}
bool PlayerNameCache::AddInfo(uint64 guid, std::string name){
PlayerNameCacheItem *cacheItem=new PlayerNameCacheItem;
cacheItem->_name=name;

View File

@ -8,6 +8,8 @@ struct PlayerNameCacheItem {
class PlayerNameCache {
public:
~PlayerNameCache();
std::string GetName(uint64);
bool IsKnown(uint64);
uint64 GetGuid(std::string);

View File

@ -53,7 +53,13 @@ class UpdateMask
inline uint32 GetLength() { return mBlocks << 2; }
inline uint32 GetCount() { return mCount; }
inline uint8* GetMask() { return (uint8*)mUpdateMask; }
inline void SetMask(uint32 *updateMask) { mUpdateMask = updateMask; }
inline void SetMask(uint32 *updateMask)
{
if(mUpdateMask)
delete [] mUpdateMask;
mUpdateMask = updateMask;
}
inline void SetCount (uint32 valuesCount)
{