Problem with snmp_free_pdu

Tarun Kumar <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CC38C57DB371F64EAF1A7BC5C1A4A488012321BE9BAE@FCEXMB02CCR.efi.internal>
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
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.