diff options
author | Adam <Adam@anope.org> | 2013-07-03 19:44:13 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-07-03 19:44:13 -0400 |
commit | c2e1a8a3e2bc2144ad0c4c6009be3ea974aef58f (patch) | |
tree | 6e138bacbfa36b2a2166527f8d32a1e5dcb9e325 /include/extensible.h | |
parent | c62b3cb275800555f4e04f294d432dccf909d134 (diff) |
Fix some warnings and errors reported by valgrind
Diffstat (limited to 'include/extensible.h')
-rw-r--r-- | include/extensible.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/extensible.h b/include/extensible.h index bd92e5635..397e3980b 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -63,12 +63,14 @@ class BaseExtensibleItem : public ExtensibleBase ~BaseExtensibleItem() { - for (std::map<Extensible *, void *>::iterator it = items.begin(); it != items.end(); ++it) + while (!items.empty()) { + std::map<Extensible *, void *>::iterator it = items.begin(); + Extensible *obj = it->first; T *value = static_cast<T *>(it->second); - items.erase(it->first); - it->first->extension_items.erase(this); + obj->extension_items.erase(this); + items.erase(it); delete value; } } @@ -188,7 +190,7 @@ class SerializableExtensibleItem<bool> : public PrimitiveExtensibleItem<bool> void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override { - bool b; + bool b = false; data[this->name] >> b; if (b) this->Set(e); |