>>>>> On Sat, 10 Sep 2005 17:32:12 +0200, Magnus Fromreide <[EMAIL PROTECTED]> 
>>>>> said:

Magnus> snmp_sess_add_ex(netsnmp_session* sess, netsnmp_transport* trans, ...)

I'd respond to that comment, but it's been a while since I looked at
that portion of the code...

Magnus> snmp_register_callback(int, int, new_callback, void* arg)

Magnus> The arg parameter is freed when clear_callback is called but
Magnus> not under any other circumstances. Who owns that pointer?  The
Magnus> implication of this one is the infamous

Callbacks, however, are more my bag (baby).  The arg is a magic
pointer supplied by the caller so the library can *never* free it
since it doesn't know how (IE, it doesn't know what it is).

What should be done, if you want proper memory controlled programming,
is that everything that registers a callback with an arg would have to
save the returned magic number and use that later to unregister it and
then free the pointer.

So:

1) the owner is the caller and always will be.
2) it's up to the caller to free it, as the library can not.  evre.

-- 
Wes Hardaker
Sparta, Inc.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to