Robert Story wrote: > 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.
I understund this could be done. Not beeing a C expert I only know that when I read the comp.lang.c FAQ they recommend against this, because it is not guaranteed to work. Is this only some theoretical/legacy rule which doesn't need to be applied on common modern platforms (ie those who NetSNMP support) and can hence safely be disregarded? //Gustaf _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
