[PATCH] dkhash: memory leak and possible loss of objects in dkhash_remove

Andreas Ericsson ae at op5.se
Thu Feb 21 11:19:28 CET 2013


On 02/20/2013 09:56 PM, Max Sikström wrote:
> The change applied is not enough. It might pass through the test
> though, because the fill-bucket and remove-from-bucket doesn't use
> key2.
> 

It's not enough.

> If key1 differs in dkhash_remove, the continue-statment is triggered,
> which skips the prev=bkt-statement.
> 


Public ridicule just because I failed hard? Totally fair, but now
I'm a sad panda. In the normal fashion, removing three lines and
replacing it with a single correct one fixes the library.

> I haven't synced the code with svn yet, but just updating with the
> changes applied in commit 2612, the test actually failes. (same as
> before)
> 

And fixing the loop makes it SIGBUS on me due to 'x' not being
signed in test-dkhash.c (line 175), which is my fault (again). I'll
amend that too.

> The only time this patch helps is if you add all values with equal
> k1, but k2 differs, then the second if statement in the loop exits
> and prev=bkt runs.
> 

The latest push makes tests pass, so things should be in good working
order now. Thanks for the patch.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb




More information about the Developers mailing list