|
Boost : |
From: Paul Du Bois (paul.dubois_at_[hidden])
Date: 2005-01-07 03:29:55
Please ignore my previous patch, if it ever made it through to the list.
I have found 3 bugs in pool::release_memory(). I am under a bit of
deadline pressure, so I'm sorry that I don't have the tuits to supply
a tested patch for the tests :-). A tentative patch that fixes the
bugs is appended, but it's only gotten the lightest of testing. I've
tried to make the changes small, but the function is complicated
enough that I'm afraid it's "no obvious bugs" rather than "obviously
no bugs".
Test case 1:
...
block N all free
Memory leak: blocks 0-(N-1) will be lost from the block list, because
prev isn't being updated correctly.
Test case 2:
block 0 some non-free
block 1 no free
block 2 all free
block 2 will not be deallocated, because prev_free is erroneously advanced
too many times. There are other failure modes of this sort, but this is the
simplest.
Test case 3 (theoretical; the others happened to me
block 0 some non-free
...
block N (last block) chunks 0-m are free, and m+1 to the end are non-free
Thus, m is the end of the freelist
Crash: trying to call nextof(0).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk