Commit
c96b6eb5ece1d44fdfbce45da2364e3764956822 changed the way mempool
code handles freed allocations that cannot be retained for later use as
"free list" items: it no longer uses different logic depending on
whether the internal allocator is used or the system one. However, that
commit did not update a relevant piece of code in isc_mempool_destroy(),
causing memory context statistics to always be off upon shutdown when
BIND 9 is built with -DISC_MEM_USE_INTERNAL_MALLOC=1. This causes
assertion failures. Update isc_mempool_destroy() accordingly in order
to prevent this issue from being triggered.
mpctx->freecount--;
item = mpctx->items;
mpctx->items = item->next;
-
- if ((mctx->flags & ISC_MEMFLAG_INTERNAL) != 0) {
- mem_putunlocked(mctx, item, mpctx->size);
- } else {
- mem_putstats(mctx, item, mpctx->size);
- mem_put(mctx, item, mpctx->size);
- }
+ mem_putstats(mctx, item, mpctx->size);
+ mem_put(mctx, item, mpctx->size);
}
MCTXUNLOCK(mctx);