On Wed, Oct 20, 2010 at 6:27 PM, Wes Hardaker <
> Regarding this change:
> > CHANGES: snmplib: Added functions snmp_register_callback2() and
> > netsnmp_register_callback2(). In contrast with the existing callback
> > registration functions, the two new functions allow to specify which
> > function to call instead of free() to deallocate the data passed to a
> > callback function. NULL is also valid, which means no deallocation
> > should be performed. Note: this change makes the
> > netsnmp_callback_clear_client_arg() superfluous.
> Wouldn't it be better to just introduce the new pointer into the
> structure and call it if set, or treat as before if it was NULL?
> That way you wouldn't need the register2 routines and wouldn't need new
Before the above changes clear_callback() was invoking free() even on data
structures that contained pointers to dynamically allocated structures,
which resulted in leaks. That's why it is necessary to be able to disable
the call to free(). There may be other ways though to disable that call to