mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
Added an assertion to verify that the first free chunk on the slab's list is really always available.
This commit is contained in:
4
library/stdlib_slab.c
Executable file → Normal file
4
library/stdlib_slab.c
Executable file → Normal file
@ -417,7 +417,7 @@ __slab_allocate(size_t allocation_size)
|
||||
* padding added to make the first allocatable slab start on
|
||||
* a 64 bit boundary.
|
||||
*/
|
||||
aligned_first_byte = ((ULONG)&new_sn[1] + MEM_BLOCKMASK) & ~MEM_BLOCKMASK;
|
||||
aligned_first_byte = (((ULONG)&new_sn[1]) + MEM_BLOCKMASK) & ~MEM_BLOCKMASK;
|
||||
|
||||
first_byte = (BYTE *)aligned_first_byte;
|
||||
last_byte = &first_byte[__slab_data.sd_StandardSlabSize - chunk_size];
|
||||
@ -446,6 +446,8 @@ __slab_allocate(size_t allocation_size)
|
||||
/* Grab the first free chunk (there has to be one). */
|
||||
chunk = (struct SlabChunk *)RemHead((struct List *)&new_sn->sn_FreeList);
|
||||
|
||||
assert( chunk != NULL );
|
||||
|
||||
/* Keep track of this chunk's parent slab. */
|
||||
chunk->sc_ParentSlab = new_sn;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user