allocator: Fix find_free() returning a block past the end when full #125
@@ -44,5 +44,8 @@ int main(int narg, char *args[])
|
||||
alloc_all(8192);
|
||||
alloc_all(8062);
|
||||
alloc_all(4096);
|
||||
alloc_all(64);
|
||||
alloc_all(63);
|
||||
alloc_all(2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,8 @@ uint64_t allocator_t::find_free()
|
||||
offset += p2;
|
||||
p2 = p2 * 64;
|
||||
}
|
||||
return addr;
|
||||
// A full single-level mask (size < 64) still has zero bits past the end
|
||||
return addr < size ? addr : UINT64_MAX;
|
||||
}
|
||||
|
||||
uint64_t allocator_t::get_free_count()
|
||||
|
||||
Reference in New Issue
Block a user