did this to fix it:

/**************************************************************************
BEFORE:
***************************************************************************/
void XXXTable_free( netsnmp_cache *cache, void *vmagic ) {
    netsnmp_tdata     *table = (netsnmp_tdata *)vmagic;
    netsnmp_tdata_row *this;

    while ((this = netsnmp_tdata_row_first(table)))  {
        netsnmp_tdata_remove_and_delete_row(table, this);
    }
}



/**************************************************************************
AFTER:
***************************************************************************/
void XXX_free( netsnmp_cache *cache, void *vmagic ) {
    netsnmp_tdata     *table = (netsnmp_tdata *)vmagic;
    netsnmp_tdata_row *this;


    while ((this = netsnmp_tdata_row_first(table)))  {
        XXX_removeEntry(table, this);
    }
}

XXX_removeEntry(table, this); generated by script but not called.
Fixed the memory leak.

FB


2013/3/1 Francois Bouchard <francois.bouch...@mpbc.ca>

>
> Hello list,
>
> We have a snmpd that have a memory leak.  The leak occurs when we are
> getting any table data.
> All of the SNMP agent's table source are auto-genereted by mib2c using :
>
> $ env MIBS="+MPBC-RMH-MIB" mib2c -c mib2c.table_data.conf
> mpbcRMHMonOsuTable
>      opt. 1) cache
>
>    Now in the auto-generated code we can see the following line :
>    mpbcRMHMonOsuTable_createEntry()
>    (...)
>        entry = SNMP_MALLOC_TYPEDEF(struct mpbcRMHMonOsuTable_entry);
>    (...)
>
>    ... but no where there is the corresponding SNMP_FREE().  Should it be
> added manually?
>
> system : linux
> net-snmp ver 5.7.1
>
>
> Thanks,
>
> Francois
>
>
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
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