While investigating a crash in pool_free_old(), I noticed another little buglet in pool_create() -- the POOL_INTERN flag is checked against pool->flags (which is newly allocated and zeroed out) instead of the flags argument.
As a result, pool->size won't get adjusted, and POOL_APPEND doesn't get added into the flags, so extent structures get allocated separately. Since POOL_INTERN is never checked for anywhere else, it ends up having no effect.
Switching the check from pool->flags to flags doesn't seem to have blown anything up for me so far. :) One-line patch to be attached...
Created attachment 2875 [details]
Patch to lib/pool_alloc.c
Much appreciated. I have committed your fix.