The page_range_allocator free() method neglected to subtract 1 from the index when checking the end of the page range in the _bitmap. Fix the calculation.
Note: with this change, the end index calculated by free() now matches the end index calculated in set_bits(). Signed-off-by: Timmons C. Player <[email protected]> --- core/mempool.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/mempool.cc b/core/mempool.cc index 569a0ac..e0d0867 100644 --- a/core/mempool.cc +++ b/core/mempool.cc @@ -767,7 +767,7 @@ void page_range_allocator::free(page_range* pr) pr2->size += pr->size; pr = pr2; } - if (_bitmap[get_bitmap_idx(*pr) + pr->size / page_size]) { + if (_bitmap[get_bitmap_idx(*pr) + pr->size / page_size - 1]) { auto pr2 = static_cast<page_range*>(static_cast<void*>(pr) + pr->size); remove(*pr2); pr->size += pr2->size; -- 2.7.4 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
