mirror of
https://github.com/adtools/clib2.git
synced 2026-05-02 18:25:54 +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:
6
library/stdlib_slab.c
Executable file → Normal file
6
library/stdlib_slab.c
Executable file → Normal file
@@ -417,8 +417,8 @@ __slab_allocate(size_t allocation_size)
|
|||||||
* padding added to make the first allocatable slab start on
|
* padding added to make the first allocatable slab start on
|
||||||
* a 64 bit boundary.
|
* 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;
|
first_byte = (BYTE *)aligned_first_byte;
|
||||||
last_byte = &first_byte[__slab_data.sd_StandardSlabSize - chunk_size];
|
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). */
|
/* Grab the first free chunk (there has to be one). */
|
||||||
chunk = (struct SlabChunk *)RemHead((struct List *)&new_sn->sn_FreeList);
|
chunk = (struct SlabChunk *)RemHead((struct List *)&new_sn->sn_FreeList);
|
||||||
|
|
||||||
|
assert( chunk != NULL );
|
||||||
|
|
||||||
/* Keep track of this chunk's parent slab. */
|
/* Keep track of this chunk's parent slab. */
|
||||||
chunk->sc_ParentSlab = new_sn;
|
chunk->sc_ParentSlab = new_sn;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user