There is a memory leak in the current and almost all previous versions of AGENT++ regarding setting the same MibLeaf object twice in the same PDU. To fix the issue the method needs to be replaced by the following code:
int MibLeaf::set(const Vbx& vb)
{
// Check if undo value already exists: if it does, the same OID is set twice in a single PDU.
// We then use the first undo value to restore both changes at once if the SET operation fails.
if (!undo) {
undo = value->clone();
}
return set_value(vb);
}
An updated AGENT++ version (4.6.0) will be available soon which fixes this issue.