Click here for full details on this thread,

http://groups.google.co.in/group/mailing.unix.net-snmp-coders/browse_thr
ead/thread/7941c72cd8bed519/e4617b5803c167a8?lnk=st&q=NETSNMP_ITERATOR_F
LAG_SORTED&rnum=10&hl=en

 

MT> if (iinfo->flags & NETSNMP_ITERATOR_FLAG_SORTED) {

MT> callback_loop_context = table_info;

MT> }

MT> index_search =

MT> (iinfo->get_first_data_point) (&callback_loop_context,

MT> &callback_data_context,

MT> index_search, iinfo);

MT>

MT> Comments? 

With sorted table registration if "index_search" is NULL then the
following statements will be executed,

 

            /* free loop context before going on */

            if (callback_loop_context &&
iinfo->free_loop_context_at_end) {

                (iinfo->free_loop_context_at_end)
(callback_loop_context,

                                                   iinfo);

                callback_loop_context = NULL;

            }

 

The argument "callback_loop_context" is having address of "table_info"
and which is being passed to "iinfo->free_loop_context_at_end" function.
This leads to calling "iinfo->free_loop_context_at_end" function even
when get_first_data_point returns NULL without setting
"my_loop_context".

In "free_loop_context_at_end" function I am freeing the memory allocated
in get_first_data_point. I am typecasting "callback_loop_context" passed
to "free_loop_context_at_end" function to my local structure for freeing
memory. Becasue of "table_info" is assigned to "callback_loop_context"
my free call will crash.

 

If I am right, we need to set "my_loop_context" to NULL while returning
NULL from get_first_data_point function. However I am not sure about the
faster access of data is not affected with the suggested fix. 

 

Thanks

-JP

NextHop Technologies

 

 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to