ck_bag: Free unoccupied blocks in ck_bag_destroy.

ck_pring
Abel Mathew 13 years ago
parent bbc6f584fd
commit 2e921847ab

@ -82,7 +82,18 @@ ck_bag_init(struct ck_bag *bag,
void
ck_bag_destroy(struct ck_bag *bag)
{
struct ck_bag_block *cursor;
struct ck_bag_block *cursor = NULL;
/*
* Free unoccupied blocks on the available list that are not linked to the
* bag list.
*/
CK_LIST_FOREACH(cursor, &bag->avail_blocks, avail_entry) {
if (ck_bag_block_count(cursor) == 0) {
CK_LIST_REMOVE(cursor, avail_entry);
allocator.free(cursor, bag->info.bytes, false);
}
}
cursor = bag->head;
while (bag->head != NULL) {

Loading…
Cancel
Save