alloc: fix free in full slab

This commit is contained in:
Mathieu Maret 2020-04-24 23:28:11 +02:00
parent 0c389afa8f
commit b2d3cd62ca

View File

@ -192,7 +192,11 @@ int freeFromSlab(void *ptr, struct slabEntry *slab)
if ((slabEntry->page <= (vaddr_t)ptr) && if ((slabEntry->page <= (vaddr_t)ptr) &&
((vaddr_t)ptr < (slabEntry->page + PAGE_SIZE))) { ((vaddr_t)ptr < (slabEntry->page + PAGE_SIZE))) {
// pr_devel("free place! was %d is now %d\n", slabEntry->freeEl, ptr); // pr_devel("free place! was %d is now %d\n", slabEntry->freeEl, ptr);
*((vaddr_t *)ptr) = (vaddr_t)slabEntry->freeEl; if (slabEntry->full) {
*((vaddr_t *)ptr) = (vaddr_t)NULL;
} else {
*((vaddr_t *)ptr) = (vaddr_t)slabEntry->freeEl;
}
slabEntry->freeEl = ptr; slabEntry->freeEl = ptr;
slabEntry->full = 0; slabEntry->full = 0;
return 1; return 1;