1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 18:26:39 +02:00

Fix some warnings and errors reported by valgrind

This commit is contained in:
Adam
2013-07-03 19:44:13 -04:00
parent c62b3cb275
commit c2e1a8a3e2
4 changed files with 13 additions and 5 deletions
+6 -4
View File
@@ -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);
+3 -1
View File
@@ -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;
}
};
+2
View File
@@ -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");
+2
View File
@@ -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 */