diff options
author | Andrei Karas <akaras@inbox.ru> | 2010-06-06 00:41:42 +0300 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-06-06 00:12:57 +0200 |
commit | 5bf9f573fd24bc8cbb6d04f17130a0beaf3c3183 (patch) | |
tree | e2cb54960be9f732eb8643dbd51c1091ce378044 /src/playerrelations.cpp | |
parent | f6583ac4b10f9e703fe1d44a1847444d34e09ab6 (diff) | |
download | mana-5bf9f573fd24bc8cbb6d04f17130a0beaf3c3183.tar.gz mana-5bf9f573fd24bc8cbb6d04f17130a0beaf3c3183.tar.bz2 mana-5bf9f573fd24bc8cbb6d04f17130a0beaf3c3183.tar.xz mana-5bf9f573fd24bc8cbb6d04f17130a0beaf3c3183.zip |
Fix memory leak in playerrelations
Reviewed-by: Thorbjørn Lindeijer
Diffstat (limited to 'src/playerrelations.cpp')
-rw-r--r-- | src/playerrelations.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index bd657f4f..14d9eb6b 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -91,13 +91,20 @@ PlayerRelation::PlayerRelation(Relation relation) PlayerRelationsManager::PlayerRelationsManager() : mPersistIgnores(false), mDefaultPermissions(PlayerRelation::DEFAULT), - mIgnoreStrategy(NULL) + mIgnoreStrategy(0) { } PlayerRelationsManager::~PlayerRelationsManager() { delete_all(mIgnoreStrategies); + + for (std::map<std::string, + PlayerRelation *>::const_iterator it = mRelations.begin(); + it != mRelations.end(); it++) + { + delete it->second; + } } void PlayerRelationsManager::clear() @@ -105,7 +112,9 @@ void PlayerRelationsManager::clear() std::vector<std::string> *names = getPlayers(); for (std::vector<std::string>::const_iterator it = names->begin(); it != names->end(); it++) + { removePlayer(*it); + } delete names; } |