On Thu, 15 Jun 2006 17:12:07 +0200 Gustaf wrote:
GG> If I was instead chosing to malloc() a netsnmp_pdu same would apply,
GG> only I would have to initialize *all* pointers inside the netsnmp_pdu in
GG> order to ensure that snmp_free_pdu() wount do any unexpected things.
GG>
GG> This is quite problematic because any code written now would have to be
GG> re-examined (or rather NetSNMP would have to be re-examined) if one were
GG> to upgrade to a newer NetSNMP version wich *could* (I know this is not
GG> likely, but ..) introduce new pointers inside the netsnmp_pdu structure.
The best thing to do here is to simply memset the structure with 0x00, or use
calloc to allocate it.
GG> I would also like a function (I think there is none now, but I will look
GG> some more) that would free all pointers inside a netsnmp_pdu but not
GG> trying to free the pdu itself.
That's reasonable... the current snmp_free_pdu() function could be split into
2 functions, one that releases the internals, and one that releases the pdu.
--
NOTE: messages sent directly to me, instead of the lists, will be deleted
unless they are requests for paid consulting services.
Robert Story; NET-SNMP Junkie
Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>
You are lost in a twisty maze of little standards, all different.
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders