Thanks Andy, Below is a diff showing the fix. Let me know if this is the same as the fix that you have made.
Regards, Neil [r...@chow InMon_Agent]# svn diff Index: sflow_sampler.C =================================================================== --- sflow_sampler.C (revision 1929) +++ sflow_sampler.C (working copy) @@ -25,15 +25,18 @@ (Thanks to Jagjit Choudray of Force 10 Networks for pointing out this bug) */ SFLDataSource_instance dsi = *pdsi; - /* preserve the *nxt pointer too, in case we are resetting this poller and it is - already part of the agent's linked list (thanks to Matt Woodly for pointing this out) */ + /* preserve the *nxt pointers too, in case we are resetting this sampler and it is + already part of the agent's linked list (thanks to Matt Woodly for pointing this out, + and to Andy Kitchingman for pointing out that it applies to the hash_nxt ptr too) */ SFLSampler *nxtPtr = sampler->nxt; + SFLSampler *hashPtr = sampler->hash_nxt; /* clear everything */ memset(sampler, 0, sizeof(*sampler)); - /* restore the linked list ptr */ + /* restore the linked list and hash-table ptrs */ sampler->nxt = nxtPtr; + sampler->hash_nxt = hashPtr; /* now copy in the parameters */ sampler->agent = agent; On Feb 8, 2010, at 3:20 PM, andy kitchingman wrote: > In addition to the fix for Matt Woodley's post "Potential memory leak in sFlow > API" on 10/05/09, I think the "hash_nxt" pointer to the sampler also needs to > be preserved when resetting the sampler. > If a sampler which is stored at a jumptable index (head of list for that slot) > gets reset, it currently loses the reference to the remaining sampler list > members that share that hash table slot. > > Regards > > Andy > > NOTICE: This message contains privileged and confidential > information intended only for the use of the addressee > named above. If you are not the intended recipient of > this message you are hereby notified that you must not > disseminate, copy or take any action in reliance on it. > If you have received this message in error please > notify Allied Telesis Labs Ltd immediately. > Any views expressed in this message are those of the > individual sender, except where the sender has the > authority to issue and specifically states them to > be the views of Allied Telesis Labs. ---- Neil McKee InMon Corp. http://www.inmon.com