mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:17:42 +00:00
LibC: Add two little assertions in malloc() and malloc_size()
This commit is contained in:
parent
ae10c9d8ec
commit
79b45f96ee
1 changed files with 3 additions and 0 deletions
|
@ -310,6 +310,7 @@ static void* malloc_impl(size_t size)
|
|||
|
||||
--block->m_free_chunks;
|
||||
void* ptr = block->m_freelist;
|
||||
ASSERT(ptr);
|
||||
block->m_freelist = block->m_freelist->next;
|
||||
if (block->is_full()) {
|
||||
g_malloc_stats.number_of_blocks_full++;
|
||||
|
@ -455,6 +456,8 @@ size_t malloc_size(void* ptr)
|
|||
auto size = header->m_size;
|
||||
if (header->m_magic == MAGIC_BIGALLOC_HEADER)
|
||||
size -= sizeof(CommonHeader);
|
||||
else
|
||||
ASSERT(header->m_magic == MAGIC_PAGE_HEADER);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue