Re: memory leak problem in tables generated with mib2c.table_data.conf

Francois Bouchard <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAAZiaZc5EvQBeOv9+3wkXGi6nvFbZXW+juiQOGttjwAu2cC7_w@mail.gmail.com>
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 <[email protected]>

>
> 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
[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.