pool->size = size /* round extent size to min alignment reqs */
? (size + MINALIGN - 1) & ~(MINALIGN - 1)
: POOL_DEF_EXTENT;
- if (pool->flags & POOL_INTERN) {
+ if (flags & POOL_INTERN) {
pool->size -= sizeof (struct pool_extent);
flags |= POOL_APPEND;
}
struct alloc_pool *pool = (struct alloc_pool *)p;
struct pool_extent *cur, *prev, *next;
- if (!pool)
+ if (!pool || !addr)
return;
- if (!addr) {
- if (!pool->extents)
- return;
- addr = PTR_ADD(pool->extents->start, pool->extents->free);
- }
-
for (prev = NULL, cur = pool->extents; cur; prev = cur, cur = cur->next) {
if (addr >= cur->start
&& addr < PTR_ADD(cur->start, pool->size))
cur->free -= skew;
}
next = cur->next;
+ cur->next = NULL;
}
} else {
next = cur->next;