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 | |
parent | c62b3cb275800555f4e04f294d432dccf909d134 (diff) |
Fix some warnings and errors reported by valgrind
-rw-r--r-- | include/extensible.h | 10 | ||||
-rw-r--r-- | modules/commands/cs_log.cpp | 4 | ||||
-rw-r--r-- | src/nickcore.cpp | 2 | ||||
-rw-r--r-- | src/regchannel.cpp | 2 |
4 files changed, 13 insertions, 5 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); diff --git a/modules/commands/cs_log.cpp b/modules/commands/cs_log.cpp index bc6ba73c6..4de7e31ee 100644 --- a/modules/commands/cs_log.cpp +++ b/modules/commands/cs_log.cpp @@ -51,7 +51,7 @@ struct LogSettingImpl : LogSetting, Serializable if (ci == NULL) return NULL; - LogSetting *ls; + LogSettingImpl *ls; if (obj) ls = anope_dynamic_static_cast<LogSettingImpl *>(obj); else @@ -69,6 +69,8 @@ struct LogSettingImpl : LogSetting, Serializable data["extra"] >> ls->extra; data["creator"] >> ls->creator; data["created"] >> ls->created; + + return ls; } }; diff --git a/src/nickcore.cpp b/src/nickcore.cpp index 9bbaae959..3b27268ea 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -113,9 +113,11 @@ Serializable* NickCore::Unserialize(Serializable *obj, Serialize::Data &data) /* compat */ bool b; + b = false; data["extensible:SECURE"] >> b; if (b) nc->Extend<bool>("NS_SECURE"); + b = false; data["extensible:PRIVATE"] >> b; if (b) nc->Extend<bool>("NS_PRIVATE"); diff --git a/src/regchannel.cpp b/src/regchannel.cpp index e06f53690..83cf2407f 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -290,10 +290,12 @@ Serializable* ChannelInfo::Unserialize(Serializable *obj, Serialize::Data &data) /* compat */ bool b; + b = false; data["extensible:SECURE"] >> b; if (b) ci->Extend<bool>("CS_SECURE"); data["extensible:PRIVATE"] >> b; + b = false; if (b) ci->Extend<bool>("CS_PRIVATE"); /* end compat */ |