Commit d125f685 authored by Micha Mueller's avatar Micha Mueller
Browse files

Fix possible memory leak

parent c317f466
......@@ -103,9 +103,11 @@ public:
auto ret = _templateSensorEntitys.insert(std::pair<std::string, SEntity*>(val.second.data(), entity));
if(!ret.second) {
LOG(warning) << "Template " << _entityName << " " << val.second.data() << " already exists! Omitting...";
delete entity;
}
} else {
LOG(warning) << "Template " << _entityName << " \"" << val.second.data() << "\" has bad values! Ignoring...";
delete entity;
}
}
//template group
......@@ -117,9 +119,11 @@ public:
auto ret = _templateSensorGroups.insert(std::pair<std::string, SGroup*>(val.second.data(), group));
if(!ret.second) {
LOG(warning) << "Template " << _groupName << " " << val.second.data() << " already exists! Omitting...";
delete group;
}
} else {
LOG(warning) << "Template " << _groupName << " \"" << val.second.data() << "\" has bad values! Ignoring...";
delete group;
}
}
//entity
......@@ -131,6 +135,7 @@ public:
_sensorEntitys.push_back(entity);
} else {
LOG(warning) << _entityName << " \"" << val.second.data() << "\" has bad values! Ignoring...";
delete entity;
}
}
//group
......@@ -142,6 +147,7 @@ public:
storeSensorGroup(group);
} else {
LOG(warning) << _groupName << " \"" << val.second.data() << "\" has bad values! Ignoring...";
delete group;
}
}
}
......@@ -287,6 +293,7 @@ protected:
sGroup.pushBackSensor(sensor);
} else {
LOG(warning) << _baseName << " " << sGroup.getGroupName() << "::" << sensor->getName() << " could not be read! Omitting";
delete sensor;
}
}
}
......@@ -344,12 +351,14 @@ protected:
auto ret = _templateSensorGroups.insert(std::pair<std::string, SGroup*>(val.second.data(), group));
if(!ret.second) {
LOG(warning) << "Template " << _groupName << " " << val.second.data() << " already exists! Omitting...";
delete group;
}
} else {
storeSensorGroup(group);
}
} else {
LOG(warning) << _groupName << " " << group->getGroupName() << " could not be read! Omitting";
delete group;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment