Fw: Two Table Subagents, 1 Crashes; Other's Fine

Ian C via Net-snmp-coders <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <[email protected]>
 Turns out that commenting out 

// iinfo->free_data_context = freeTableEntry;
introduces a memory leak.
Really at a loss. If anyone has any ideas pls let me know.
Ian

   ----- Forwarded Message ----- From: Ian C via Net-snmp-coders <[email protected]>To: [email protected] <[email protected]>Sent: Friday, August 21, 2020, 2:01:12 p.m. EDTSubject: Two Table Subagents, 1 Crashes; Other's Fine
 
I'm having an issue with a table subagent that crashes with (SIGABRT) when querried. This subagent was working under a previous OS (qnx 6.5) and Net-Snmp 5.6, but now under qnx 7.1 & Net-Snmp 5.9 it crashes.

I was comparing it to another table subagent that I have and works fine, they were both generated:

    auto-generated by mib2c using : mib2c.iterate.conf 

In comparing the code I noticed that the one that crashes has a slightly different initialization in the initialize_table...(), in that it has entries for:

    iinfo->free_loop_context_at_end = nsModuleTable_loop_free;
    iinfo->free_data_context = freeTableEntry;

The subagent that works ok has no such entries.

If I comment out the 

   // iinfo->free_data_context = freeTableEntry;

No crash, and (I may be wrong here) no increase in memory usage (but there may be, only investigated a little).

But with the 

    free_data_context = freeTableEntry

It crashes with this stack:

SignalKill() at SignalKill.S:38 0x1012d078a    
__malloc_panic_str() at dlist.c:127 0x1012b4552    
_list_release() at dlist.c:1,053 0x1012b5cd0    
__prelocked_free() at malloc.c:392 0x1012b88dc    
__free() at malloc.c:425 0x1012b88dc    
__free() at malloc.c:410 0x1012b88dc    
freeTableEntry() at chAsinHwSbcNtpTable.cpp:43 0x804db13    <<<<<<<<<<< MY SUBAGENT
netsnmp_free_ti_cache() at table_iterator.c:390 0x80533ea    
netsnmp_free_list_data() at data_list.c:40 0x80d5c92    
netsnmp_free_all_list_data() at data_list.c:52 0x80d5c92    



void freeTableEntry( void *data_context, netsnmp_iterator_info *useless ) {
      if (data_context != NULL) {
          free(data_context);  <<<<<<<<<<<<<<<<<<<<<<<<< HERE
      }
    return;
}

Anyone have any thoughts?

thanks,
Ian
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
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.