Hi,

I do not know if anyone supports these sources any more but I found a memleak in
UCD-SNMP 4.2.5 yesterday.

It is a special case but it eats up memory very quickly:

If there is an SNMPv1 GET-Request which contains multiple OIDs
AND there are unknown OIDs in it
AND there are known OIDs before the first unknown which are handled by an
agentx-subagent

the agent allocates agentx-request with cb_data and a pdu but only the requests
are getting freed.

The problem lies in handle_next_pass in snmp_agent.c, if handle_var_list returns
an error and there are outstanding requests.
I also checked 4.2.6 and the code is the same.

Here is the code-part (starting at line 787 in snmp_agent.c, version 4.2.6)

else {
  /* discard outstanding requests */
for ( req_p = asp->outstanding_requests ;
        req_p != NULL ; req_p = next_req ) {
                        
  next_req = req_p->next_request;
  free( req_p );
}

after changing it to

else {
  /* discard outstanding requests */
for ( req_p = asp->outstanding_requests ;
        req_p != NULL ; req_p = next_req ) {
                        
  next_req = req_p->next_request;
  if(req_p->pdu)
  {
    snmp_free_pdu(req_p->pdu);
  }
  if(req_p->cb_data)
  {
    free(req_p->cb_data);
  }
  free( req_p );
}

the agent no longer eats up memory.

greetings
Wolfgang Pedot


-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to