snmpTreeNext(oid * Current, snint CurrentLen, oid ** Next, snint * NextLen)
{
oid_ParseFn *Fn = NULL;
- mib_tree_entry *mibTreeEntry = NULL, *nextoid = NULL;
int count = 0;
debugs(49, 5, "snmpTreeNext: Called");
MemBuf tmp;
debugs(49, 6, "snmpTreeNext: Current : " << snmpDebugOid(Current, CurrentLen, tmp));
- mibTreeEntry = mib_tree_head;
+ mib_tree_entry *mibTreeEntry = mib_tree_head;
- if (Current[count] == mibTreeEntry->name[count]) {
+ if (mibTreeEntry && Current[count] == mibTreeEntry->name[count]) {
++count;
while ((mibTreeEntry) && (count < CurrentLen) && (!mibTreeEntry->parsefunction)) {
if ((mibTreeEntry) && (mibTreeEntry->parsefunction)) {
--count;
- nextoid = snmpTreeSiblingEntry(Current[count], count, mibTreeEntry->parent);
+ mib_tree_entry *nextoid = snmpTreeSiblingEntry(Current[count], count, mibTreeEntry->parent);
if (nextoid) {
debugs(49, 5, "snmpTreeNext: Next OID found for sibling" << nextoid );
mibTreeEntry = nextoid;
while ((current) && (!current->parsefunction))
current = current->leaves[0];
+ if(!current)
+ return (instance);
+
instance = client_Inst(current->name, len, current, Fn);
} else if (*len <= current->len) {
debugs(49, 6, "snmp peer_Inst: *len <= current->len ???");