* commit '283ec6256bdde5685f224efdc67a061cc611b33a': Fix for linker allocator
This commit is contained in:
commit
3d80e36a85
@ -117,8 +117,8 @@ LinkerAllocatorPage* LinkerBlockAllocator::find_page(void* block) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LinkerAllocatorPage* page = page_list_;
|
LinkerAllocatorPage* page = page_list_;
|
||||||
const uint8_t* page_ptr = reinterpret_cast<const uint8_t*>(page);
|
|
||||||
while (page != nullptr) {
|
while (page != nullptr) {
|
||||||
|
const uint8_t* page_ptr = reinterpret_cast<const uint8_t*>(page);
|
||||||
if (block >= (page_ptr + sizeof(page->next)) && block < (page_ptr + PAGE_SIZE)) {
|
if (block >= (page_ptr + sizeof(page->next)) && block < (page_ptr + PAGE_SIZE)) {
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,9 @@ TEST(linker_allocator, test_larger) {
|
|||||||
ASSERT_TRUE(allocator.alloc() != nullptr);
|
ASSERT_TRUE(allocator.alloc() != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_struct_larger* ptr_to_free = allocator.alloc();
|
||||||
|
ASSERT_TRUE(ptr_to_free != nullptr);
|
||||||
|
allocator.free(ptr1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void protect_all() {
|
static void protect_all() {
|
||||||
|
Loading…
Reference in New Issue
Block a user