When adding a new buffer to the beginning of the memory pool, we were
accidentally deleting the buffer that was first in the buffer list.
This was caused by a bug in the memory pool's linked list
implementation.
}
} else {
/* Add item to the front of the list */
- item->next = pool->item_list->next;
- if (pool->item_list->next) {
- pool->item_list->next->prev = item;
- }
+ item->next = pool->item_list;
item->prev = pool->item_list->prev;
- if (pool->item_list->prev) {
- pool->item_list->prev->next = item;
- }
+ pool->item_list->prev = item;
pool->item_list = item;
}
}