Re: snmp_api.c/snmp_pdu_parse() not initializing pointers

This is a discussion on Re: snmp_api.c/snmp_pdu_parse() not initializing pointers within the SNMP Coders forums, part of the Networking and Network Related category; On Thu, 15 Jun 2006 17:12:07 +0200 Gustaf wrote: GG> If I was instead chosing to malloc() ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-16-2006
Robert Story
 
Posts: n/a
Default Re: snmp_api.c/snmp_pdu_parse() not initializing pointers

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
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:40 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0