Hi,
I am working on some agent development with Net-SNMP, while doing my testing I 
came across some issues with snmp_free_pdu, it is somehow calling free for the 
same variable again and crashing.

I had to make following changes to make it work:

void
snmp_free_pdu(netsnmp_pdu *pdu)
{
    struct snmp_secmod_def *sptr;

    if (!pdu)
        return;

    /*
    if (pdu->command == 0) {
        snmp_log(LOG_WARNING, "snmp_free_pdu probably called twice\n");
        return;
    }
     */
    if ((sptr = find_sec_mod(pdu->securityModel)) != NULL &&
        sptr->pdu_free != NULL) {
        (*sptr->pdu_free) (pdu);
    }
    snmp_free_varbind(pdu->variables);
    SNMP_FREE(pdu->enterprise);
    SNMP_FREE(pdu->community);
    SNMP_FREE(pdu->contextEngineID);
    SNMP_FREE(pdu->securityEngineID);
    SNMP_FREE(pdu->contextName);
    SNMP_FREE(pdu->securityName);
    SNMP_FREE(pdu->transport_data);
    // Changed it
    memset(pdu, 0, sizeof(netsnmp_pdu));
    //SNMP_FREE(pdu);          /* commented out */
}

Has anybody faced this problem before or any patch for this ?


Regards
-tarun

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to