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 
<net-snmp-coders@lists.sourceforge.net>To: 
net-snmp-coders@lists.sourceforge.net 
<net-snmp-coders@lists.sourceforge.net>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
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
  
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to